I want to compare these two ArrayList:
public static ArrayList<List<String>> arrayList1 = new ArrayList<List<String>>();
public static ArrayList<List<String>> arrayList2 = new ArrayList<List<String>>();
If they have the same elements it will return true, otherwise false.
You can try using Apache commons CollectionUtils.retainAll method : Returns a collection containing all the elements in collection1 that are also in collection2.
If the size of commonList is equal to
arrayList1andarrayList2you can say both the list are same.