一:单个属性去重

按List<User>中的name去重

list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(s -> s.getName()))), ArrayList::new))
                .forEacha(System.out::println);

二:多个属性去重

按List<User>中的name,age去重

list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(s -> s.getName()+":"+s.getAge))), ArrayList::new))
                .forEacha(System.out::println);