Java ArrayList – how can I tell if two lists are equal, order not mattering?

Probably the easiest way for any list would be:

listA.containsAll(listB) && listB.containsAll(listA)

Leave a Comment