Android examples for java.util:Collection
internal Are Collections Equal
import java.util.ArrayList; import java.util.Collection; import java.util.List; public class Main{ private static <T> boolean internalAreCollectionsEqual(Collection<T> a, Collection<T> b, int size) { List<T> aCopy, bCopy; aCopy = new ArrayList<T>(a); bCopy = new ArrayList<T>(b); for (int i = 0; i < size; i++) { T item = aCopy.get(i);//from ww w .j a v a 2s. c o m if (!bCopy.remove(item)) return false; } if (!bCopy.isEmpty()) return false; return true; } }