stream流的filter和map过滤

详情页面

// 过滤出身高大于 170 的记录
personList.stream().filter((item)->item.getHeight() > 170).forEach(System.out::println);
//从对象中提取age。并过滤年龄
List<Integer>   nameList=studentList.stream().map(StudentInfo::getAge).filter(f->f>18).distinct().collect(Collectors.toList());

猜你喜欢

转载自blog.csdn.net/qq_49641620/article/details/133375909