List<ClassEntity> distinctClass = classEntities.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(o ->
o.getName() + ";" + o.getAge()))), ArrayList::new));
//根据相同名字和年龄的记录去重
stream 多字段去重记录
最新推荐文章于 2024-04-16 14:44:33 发布