lambda 对象属性去重

 List<XXX> distinctList = list.stream().collect(
                Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getY()))),
                        ArrayList::new));

猜你喜欢

转载自blog.csdn.net/weixin_39195030/article/details/82977186
今日推荐