Java List Equal equals(List list1, List list2)

Here you can find the source of equals(List list1, List list2)

Description

equals

License

Apache License

Declaration

public static <T> boolean equals(List<T> list1, List<T> list2) 

Method Source Code


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

import java.util.List;

public class Main {
    public static <T> boolean equals(List<T> list1, List<T> list2) {
        if (list1 == null && list2 == null) {
            return true;
        }/*from  w  w  w  .j  a v  a  2s  .c  o  m*/
        if (list1 == null || list2 == null) {
            return false;
        }
        for (int i = 0; i < list1.size(); i++) {
            if (!list1.get(i).equals(list2.get(i))) {
                return false;
            }
        }
        return true;
    }
}

Related

  1. equals(List list, Object o)
  2. equals(List l1, List l2, boolean ignoreCase)
  3. equals(List list1, List list2)
  4. equals(List lhs, List rhs)
  5. equals(List lhs, List rhs, Comparator comparator)
  6. equalsAny(String toMatch, List matchesAny)
  7. equalsBasedOnEntryIdentity(final List a, final List b)
  8. equalShallow(List list0, List list1)
  9. isEqual(Collection listA, Collection listB)