Here you can find the source of compareLists(List
public static <E> boolean compareLists(List<E> l1, List<E> l2)
//package com.java2s; /*/*from ww w .j av a 2 s .c o m*/ Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved See License.txt in the project root for license information. */ import java.util.List; public class Main { public static <E> boolean compareLists(List<E> l1, List<E> l2) { return compareArrays(l1.toArray(), l2.toArray()); } public static boolean compareArrays(Object[] arr1, Object[] arr2) { if (arr1 == null && arr2 == null) { return true; } if (arr1 == null || arr2 == null) { return false; } if (arr1.length != arr2.length) { return false; } for (int i = 0; i < arr1.length; i++) { Object o1 = arr1[i]; Object o2 = arr2[i]; if (!compare(o1, o2)) { return false; } } return true; } public static boolean compare(Object o1, Object o2) { if (o1 == null && o2 == null) { return true; } if (o1 == null || o2 == null) { return false; } return o1.equals(o2); } }