List<>集合对象去重

List<ExamSubjects> unique = strings.stream().collect(
Collectors.collectingAndThen(
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(ExamSubjects::getId))), ArrayList::new)
);

posted @ 2021-05-17 17:47  教练我想打篮球  阅读(34)  评论(0编辑  收藏  举报