需求:
利用java帮list去重
解决:
利用java8的新特性lambda表达式去重
List<DCodeTable> distinctList = list.stream().collect(//list是需要去重的list,返回值是去重后的list
Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getAttributeCode()))),//o代表object对象,o.list对象的属性值,根据此属性值去重
ArrayList::new));