list使用lambda去重 15951924819 2019-07-12 2,191 阅读1分钟 List distinctList = list.stream().collect( Collectors.collectingAndThen( Collectors.toCollection( () -> new TreeSet<>(Comparator.comparing(o -> o.getAttributeCode())) ), ArrayList::new ) );