ArrayList常用去重代码

List<user>userlist=allUserList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(x -> x.getid()))), ArrayList::new));

 

posted @ 2020-02-15 15:27  卷心菜的奇妙历险  阅读(137)  评论(0编辑  收藏  举报