Here you can find the source of compareLists(Object obj1, Object obj2)
public static boolean compareLists(Object obj1, Object obj2)
//package com.java2s; //License from project: Open Source License import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; public class Main { public static boolean compareLists(Object obj1, Object obj2) { if (null == obj1 && null == obj2) { return true; } else if (null != obj1 && null != obj2) { if (obj1 instanceof List && obj2 instanceof List) { if (((List) obj1).size() != ((List) obj2).size()) { return false; } else { Set set = new HashSet(); Iterator i$ = ((List) obj1).iterator(); Object objTmp; while (i$.hasNext()) { objTmp = i$.next(); if (null != objTmp) { set.add(objTmp); }//from w w w . j a v a 2 s .c o m } i$ = ((List) obj2).iterator(); do { if (!i$.hasNext()) { return true; } objTmp = i$.next(); } while (null == objTmp || set.contains(objTmp)); return false; } } else { return false; } } else { return false; } } }