List<T> list = list.stream().collect(
Collectors.collectingAndThen(
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(T::属性))), ArrayList::new)
);
list. forEach (p -> System.out.println(p));
文章来源:智云一二三科技
文章标题:java8实现List中对象属性的去重
文章地址:https://www.zhihuclub.com/196494.shtml