Map<Object, Boolean> map = new HashMap<>();
dtoList = dtoList.stream().filter(i -> map.putIfAbsent(i.getCompanyName(), Boolean.TRUE) == null).collect(Collectors.toList());
list根据某个属性字段做去重
List<Entity> distinctList = list.stream()
.distinct()
.collect(Collectors.collectingAndThen(
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(Entity::getProperty))),
ArrayList::new));
博客主要提及对list根据某个属性字段进行去重的内容,聚焦于信息技术中数据处理方面的操作。
8642

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



