您的位置 首页 java

java8实现List中对象属性的去重

 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

关于作者: 智云科技

热门文章

网站地图