实体类
ZcChange
根据 ZcChange实体类中的name字段进行去重 调用test的方法 返回一个去重后的list集合
/*对象去重*/
public static List<ZcChange> test(List<ZcChange> list){
List<ZcChange> unique = list.stream().collect(
collectingAndThen(
toCollection(() -> new TreeSet<>(comparing(ZcChange::getName))), ArrayList::new)
);
return unique;
}