Java8根据某字段去重

    subjects = subjects.stream().collect(
                    Collectors.collectingAndThen(
                            Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(Subjects::getId))), ArrayList::new)
            );

 

posted @ 2020-06-22 11:19  辰梓悦  阅读(2239)  评论(0编辑  收藏  举报