Java List Equal areEqual(List a, List b)

Here you can find the source of areEqual(List a, List b)

Description

are Equal

License

Apache License

Declaration

public static boolean areEqual(List a, List b) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.List;

public class Main {
    public static boolean areEqual(Object obj, Object obj1) {
        if (obj == obj1) {
            return true;
        }/*from   ww  w  . j  a  v a 2 s. co m*/
        if (obj == null || obj1 == null) {
            return false;
        }
        return obj.equals(obj1);
    }

    public static boolean areEqual(List a, List b) {
        if (a == b) {
            return true;
        }
        if (a == null || b == null) {
            return false;
        }
        if (a.size() != b.size()) {
            return false;
        }
        for (int i = 0; i < a.size(); i++) {
            if (!areEqual(a.get(i), b.get(i))) {
                return false;
            }
        }
        return true;
    }
}

Related

  1. areEqual(final List list1, final List list2)
  2. areEqual(List list1, List list2)
  3. areEqualConsideringOrder(List listA, List listB)
  4. equal(List coll, List otherColl)
  5. equal(List objects)