// xxx 表示你需要去重的字段 列如(o -> o.id()) 返回已經(jīng)去重集合
List<AddEventAndProperty> nameDistinct = list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(o -> xxx))), ArrayList::new));
// 通過多個(gè)字段去重,返回已經(jīng)去重集合
List<AddEventAndProperty> distinctClass = list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.id() + ";" + o.getName()))), ArrayList::new));
// 根據(jù)scId去重
ArrayList<Quota> collect = tickets.stream().collect(
Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparingLong(Quota::getScId))), ArrayList::new));