List<ClassEntity> distinctClass = classEntities.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(o ->
o.getName() + ";" + o.getAge()))), ArrayList::new));
//根据相同名字和年龄的记录去重
List<ClassEntity> distinctClass = classEntities.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(o ->
o.getName() + ";" + o.getAge()))), ArrayList::new));
//根据相同名字和年龄的记录去重

被折叠的 条评论
为什么被折叠?