Question

How can I easily check to see whether all the elements in one ArrayList are all elements of another ArrayList?

Was it helpful?

Solution

Use Collection.containsAll():

boolean isSubset = listA.containsAll(listB);

OTHER TIPS

There is a containsAll method in all collections.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top