Java List Compare compare(List a, List b)

Here you can find the source of compare(List a, List b)

Description

compare

License

Open Source License

Declaration

public static <T extends Comparable<T>> boolean compare(List<T> a, List<T> b) 

Method Source Code


//package com.java2s;
import java.util.Collections;
import java.util.List;

public class Main {

    public static <T extends Comparable<T>> boolean compare(List<T> a, List<T> b) {
        if (a.size() != b.size())
            return false;
        Collections.sort(a);/*from   ww w . j av a 2  s .  c o m*/
        Collections.sort(b);
        for (int i = 0; i < a.size(); i++) {
            if (!a.get(i).equals(b.get(i)))
                return false;
        }
        return true;
    }
}

Related

  1. compare(List lhs, Collection rhs, List standard)
  2. compare(List> beanList1, List> beanList2, final int[] sortKeys, final boolean[] sortAscending, final boolean nullAlwaysFirst, final int naOrder)
  3. compare(List list1, List list2)
  4. compare(List a, List b)
  5. compare(List strList1, List strList2)
  6. compare(String str, List list)
  7. compareByList(List list, T a, T b)
  8. compareFileLists(List expected, List gotten)
  9. compareIncarnations(List e1, List e2)