Java Utililty Methods List Compare

List of utility methods to do List Compare

Description

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

Method

intcompareIncarnations(List e1, List e2)
compare two incarnation values.
for (int j = 0; j < e1.size(); j++) {
    if (e1.get(j) < e2.get(j))
        return -1;
    if (e1.get(j) > e2.get(j))
        return 1;
return 0;
booleancompareList(List listA, List listB)
Compares two lists
if (listA == null && listB == null)
    return true;
if (listA == null || listB == null)
    return false;
if (listA.size() != listB.size())
    return false;
return listA.containsAll(listB);
booleancompareList(Object eObj, Object rObj)
compare List
if (eObj == null || rObj == null) {
    return false;
if (!(rObj instanceof List)) {
    return false;
List<Object> eList = (List<Object>) eObj;
List<Object> rList = (List<Object>) rObj;
...
booleancompareLists(Class type, List list1, List list2)
compare Lists
List<T> tmp = new LinkedList<T>();
tmp.addAll(list2);
for (T element : list1) {
    boolean found = false;
    Iterator<T> it = tmp.iterator();
    while (it.hasNext()) {
        T e = it.next();
        if (e.equals(element)) {
...
intcompareLists(final List list1, final List list2)
compare Lists
if (list1 == null) {
    return -1;
if (list2 == null) {
    return 1;
int comparison = list1.size() - list2.size();
if (comparison == 0) {
...
booleancompareLists(List strings1, List strings2, boolean ignoreCase)
Determines if the lists of strings contain equal strings
int size1 = strings1.size();
int size2 = strings2.size();
if (size1 != size2) {
    return false;
for (int i = 0; i < size1; i++) {
    if (ignoreCase) {
        if (!((String) strings1.get(i)).equals(strings2.get(i))) {
...
booleancompareLists(List l1, List l2)
compare Lists
return compareArrays(l1.toArray(), l2.toArray());
booleancompareLists(List list, List> listOfLists)
compare Lists
int i = 0;
for (List<E> curList : listOfLists) {
    for (E item : curList) {
        if (!item.equals(list.get(i))) {
            return false;
        i++;
return true;
intcompareLists(List a, List b)
compare two lists
if (a == b)
    return 0;
if (a != null && b == null)
    return -1;
if (a == null && b != null)
    return 1;
if (a.size() != b.size())
    return -1;
...
intcompareLists(List a, List b)
Compare two lists of things which extend the same type .
final Iterator<T> left = a.iterator();
final Iterator<T> right = b.iterator();
if (left.hasNext()) {
    if (!right.hasNext()) {
        return -1;
    final T l = left.next();
    final T r = right.next();
...