创建对象
Student student1 = new Student("张三",20,"周");
Student student2 = new Student("李四",30,"上号");
Student student3 = new Student("王五",18,"阿西吧");
Student student4 = new Student("氨纶",19,"阿西吧");
Student student5 = new Student("氨纶",19,"阿西吧1");
其中对于name去重
List<Student> collect = Arrays.asList(student1,student2,student3,student4,student5);
List<Student> unique = collect.stream().collect(Collectors.collectingAndThen(
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(Student::getName))), ArrayList::new));
unique.forEach(p -> System.out.println(p));