List<Student> studentListNamePd = demo.studentsList.stream().
filter(student -> !"孔明".equals(student.getName())
&& !"仲谋".equals(student.getName())).collect(Collectors.toList());
studentListNamePd.stream().forEach(System.out::println);
filter 操作就是对list集合进行判断 这里判断 是不包含孔明和仲谋的
List<Student> studentListQuantitativeRestrictions = demo.studentsList.stream()
//对集合的数量进行限制 limit限制多少个
.limit(1).collect(Collectors.toList());
studentListQuantitativeRestrictions.stream().forEach(System.out::println);
limit 对集合的数量进行限制
List<Student> studentListJumpOver = demo.studentsList.stream()
//集合从第几个开始
.skip(7).collect(Collectors.toList());
skip 集合从第几个开始
Map<Long, String> map = demo
.studentsList.stream()
//toMap (key:value)
.collect(Collectors.toMap(Student::getId, Student::getName));
//toMap把集合转换成map集合 第一个是key值第二给对应的value
Optional<Student> olderStudent = demo.studentsList.stream()
.collect(Collectors.maxBy((o1, o2) -> o1.getAge() - o2.getAge()));