标签:字段 list() java8 array 去重 new com tin div
1.对多个字段去重复
ArrayList<SupplierDeliveryCountNum> collect = numlist.stream() .collect(Collectors.collectingAndThen( Collectors.toCollection(() -> new TreeSet<>( Comparator.comparing(o -> o.getDeliveryId() + ";" + o.getNum()))), ArrayList::new));
2. 对全部字段去重复
List<SupplierDeliveryCountNum> distinctIdList = numlist.stream().distinct() .collect(Collectors.toList());
.
标签:字段 list() java8 array 去重 new com tin div
原文地址:https://www.cnblogs.com/PinkPink/p/14707362.html