对象集合,根据某个属性去重
// 根据id去重
List<Person> unique = queryRes.stream().collect(
Collectors.collectingAndThen(
Collectors.toCollection(
() -> new TreeSet<>(Comparator.comparingInt(Person::getId))
),
ArrayList::new
)
);
对象集合进行去重(对象重写了equals()和hashcode()方法)
new ArrayList(new HashSet(sampleFrameConditionModels));