How to check whether the elements of an ArrayList

2019-01-26 03:51发布

问题:

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

回答1:

Use Collection.containsAll():

boolean isSubset = listA.containsAll(listB);


回答2:

There is a containsAll method in all collections.