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

booleanequals(List l1, List l2, boolean ignoreCase)
equals
if (l1 == null || l2 == null) {
    return false;
if (l1.size() != l2.size()) {
    return false;
for (int i = 0; i < l1.size(); i++) {
    if (ignoreCase) {
...
booleanequals(List list1, List list2)
equals
return false;
booleanequals(List lhs, List rhs)
equals
if (lhs == rhs)
    return true;
if ((lhs == null) != (rhs == null))
    return false;
if (lhs.size() != rhs.size())
    return false;
Iterator<String[]> li = lhs.iterator();
Iterator<String[]> ri = rhs.iterator();
...
booleanequals(List lhs, List rhs, Comparator comparator)
Compare two lists using the comparator for all comparisons (not using the equals() operator)
final int lhsSize = lhs.size();
if (lhsSize != rhs.size()) {
    return false;
Collections.sort(lhs, comparator);
Collections.sort(rhs, comparator);
for (int i = 0; i < lhsSize; ++i) {
    if (comparator.compare(lhs.get(i), rhs.get(i)) != 0) {
...
booleanequals(List list1, List list2)
equals
if (list1 == null && list2 == null) {
    return true;
if (list1 == null || list2 == null) {
    return false;
for (int i = 0; i < list1.size(); i++) {
    if (!list1.get(i).equals(list2.get(i))) {
...
booleanequalsAny(String toMatch, List matchesAny)
equals Any
return matchesAny != null && matchesAny.contains(toMatch);
booleanequalsBasedOnEntryIdentity(final List a, final List b)
equals Based On Entry Identity
if (a == b) {
    return true;
if (a == null || b == null) {
    return false;
final int aSize = a.size();
final int bSize = b.size();
...
booleanequalShallow(List list0, List list1)
Returns whether two lists are equal to each other using shallow comparisons.
if (list0.size() != list1.size()) {
    return false;
for (int i = 0; i < list0.size(); i++) {
    if (list0.get(i) != list1.get(i)) {
        return false;
return true;
booleanisEqual(Collection listA, Collection listB)
Return true if same objects exist in listA and listB
if (listA.size() != listB.size()) {
    return false;
if (listA.size() != setIntersection(listA, listB).size()) {
    return false;
return true;
booleanisEqual(List list1, List list2)
Checks if the given list are equals, this means that they contain the same elements.
if (list1.size() != list2.size()) {
    return false;
for (Iterator<? extends Object> it = list1.iterator(); it.hasNext();) {
    Object obj = it.next();
    if (!list2.contains(obj)) {
        return false;
return true;