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