Check if an ArrayList contains every element from another ArrayList (or Collection)

前端 未结 7 1100
甜味超标
甜味超标 2020-11-28 10:12

There is probably a simple one-liner that I am just not finding here, but this is my question:

How do I check if an ArrayList contains all of the objects in another

相关标签:
7条回答
  • 2020-11-28 11:06

    isEqualCollection() method declared in the org.apache.commons.collections.CollectionUtils gives you the collections are same or not.

    if (CollectionUtils.isEqualCollection(collectionA,collectionB)) { do smt... }

    0 讨论(0)
提交回复
热议问题