Java List Equal equals(List l1, List l2, boolean ignoreCase)

Here you can find the source of equals(List l1, List l2, boolean ignoreCase)

Description

equals

License

Apache License

Declaration

public static boolean equals(List<String> l1, List<String> l2, boolean ignoreCase) 

Method Source Code


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

import java.util.List;

public class Main {
    public static boolean equals(List<String> l1, List<String> l2, boolean ignoreCase) {
        if (l1 == null || l2 == null) {
            return false;
        }//from w  ww  .j  a v  a 2  s. c  o m

        if (l1.size() != l2.size()) {
            return false;
        }

        for (int i = 0; i < l1.size(); i++) {
            if (ignoreCase) {
                if (!l1.get(i).equalsIgnoreCase(l2.get(i))) {
                    return false;
                }
            } else {
                if (!l1.get(i).equals(l2.get(i))) {
                    return false;
                }
            }
        }

        return true;
    }
}

Related

  1. equals(List c1, List c2)
  2. equals(List list1, List list2)
  3. equals(List lst1, List lst2)
  4. equals(List l1, List l2)
  5. equals(List list, Object o)
  6. equals(List list1, List list2)
  7. equals(List lhs, List rhs)
  8. equals(List lhs, List rhs, Comparator comparator)
  9. equals(List list1, List list2)