您的位置 首页 java

小记·JDK8 stream 根据对象的一个属性去重

 List<User> userList=userList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(User :: getUserid))), ArrayList::new));  

文章来源:智云一二三科技

文章标题:小记·JDK8 stream 根据对象的一个属性去重

文章地址:https://www.zhihuclub.com/180464.shtml

关于作者: 智云科技

热门文章

网站地图