Java Utililty Methods List Equal

List of utility methods to do List Equal

Description

The list of methods to do List Equal are organized into topic(s).

Method

booleanareEqual(final List list1, final List list2)
Returns whether lists are equal or not.
if (list1 == null && list2 == null) {
    return true;
} else if ((list1 == null || list2 == null) && list1 != list2) {
    return false;
} else {
    if (list1.size() != list2.size()) {
        return false;
    } else {
...
booleanareEqual(List a, List b)
are Equal
if (a == b) {
    return true;
if (a == null || b == null) {
    return false;
if (a.size() != b.size()) {
    return false;
...
booleanareEqual(List list1, List list2)
are Equal
if (list1 == null)
    return list2 == null;
if (list2 == null)
    return false;
int size = list1.size();
if (size != list2.size()) {
    return false;
for (int i = 0; i < size; i++) {
    if (list1.get(i) != list2.get(i)) {
        if (list1.get(i) == null || list2.get(i) == null) {
            return false;
        } else if (!list1.get(i).equals(list2.get(i))) {
            return false;
return true;
booleanareEqualConsideringOrder(List listA, List listB)
are Equal Considering Order
return !areDifferentConsideringOrder(listA, listB);
booleanequal(List coll, List otherColl)
equal
if (coll == null && otherColl == null)
    return true;
if (coll == null && otherColl != null && otherColl.size() < 1)
    return true;
if (coll != null && coll.size() < 1 && otherColl == null)
    return true;
if (coll != null && coll.size() > 0 && otherColl == null)
    return false;
...
booleanequal(List objects)
equals for a list of objects
int size = objects.size();
if (size < 2) {
    return true;
Object object = objects.get(0);
for (int i = 1; i < size; i++) {
    if (!objects.get(i).equals(object)) {
        return false;
...
booleanequal(List v1, List v2)
equal
return !v1.retainAll(v2);
booleanequalLists(List a, List b)
equal Lists
return (a == null && b == null) || a.equals(b);
booleanequalLists(List aV1, List aV2)
compares two List instances.
if ((aV1 == null) && (aV2 == null)) {
    return true;
else if ((aV1 != null) && (aV2 != null)) {
    if (aV1.size() != aV2.size()) {
        return false;
    Iterator v1Iter = aV1.iterator();
...
booleanequalLists(List list1, List list2)
equal Lists
return (list1.containsAll(list2) && list2.containsAll(list1));