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());
.