How Best to Compare Two Collections in Java and Act on Them?

前端 未结 8 2193
生来不讨喜
生来不讨喜 2020-12-03 00:41

I have two collections of the same object, Collection oldSet and Collection newSet. The required logic is as follow:

8条回答
  •  盖世英雄少女心
    2020-12-03 01:13

    Apache's commons.collections library has a CollectionUtils class that provides easy-to-use methods for Collection manipulation/checking, such as intersection, difference, and union.

    The org.apache.commons.collections.CollectionUtils API docs are here.

提交回复
热议问题