stream java8 去重复元素

           reports = reports.stream().collect(Collectors.collectingAndThen(
                                Collectors.toCollection(() ->
                                        new TreeSet<>(Comparator.comparing(YyAmazonInventoryReport::getSku))),
                                ArrayList::new)
                        );

 

posted @ 2021-06-22 14:38  这很周锐  阅读(1384)  评论(0编辑  收藏  举报