T:为实体对象,get方法为去重对象属性,返回list<T> List<T> distinctClass = t.stream(). collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getId() + ";" + o.getName()))), ArrayList::new));
java8 list 多属性 去重
阅读 131
2022-01-30
T:为实体对象,get方法为去重对象属性,返回list<T> List<T> distinctClass = t.stream(). collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getId() + ";" + o.getName()))), ArrayList::new));
相关推荐
精彩评论(0)