根据单个条件去重
list.stream().collect(
Collectors.collectingAndThen(
Collectors.toCollection(
() -> new TreeSet<>(
Comparator.comparing(Class::getParams)))
, ArrayList::new));
根据多条件去重
list.stream().collect(
Collectors.collectingAndThen(
Collectors.toCollection(
() -> new TreeSet<>(
Comparator.comparing(a->a.getParam1+";"+a.getParam2)))
, ArrayList::new));