打赏

java 对list数据 根据某个字段去掉重复数据

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

 

posted @ 2020-05-08 10:22  张学涛  阅读(3600)  评论(0编辑  收藏  举报