You can convert an ArrayList to a set using a HashSet:
HashSet listSet = new HashSet(arrayList);
To check if an element ArrayListinitially has more elements, simply compare the results listSetand ArrayList size():
boolean sameSize = listSet.size() == arrayList.size()
Then you can get the intersection of two sets (common elements):
listSet.retainAll(set1)
listSet.size() == set1.size(), , . , , : if sameSize is true, , false , .