Java 使用Stream处理List对象去重

// 根据name去重
List<Person> unique = persons.stream().collect(
            Collectors.collectingAndThen(
                    Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(Person::getName))), ArrayList::new)
);
原文地址:https://www.cnblogs.com/zhuzhen/p/14048078.html