Java8新特性 实现 举例
案例一
List<LinkedHashMap<String, Object>> effective = syncCertList.stream().filter(el->{
Object courseCode = el.get("courseCode");//课程编号
Object employeeCode = el.get("employeeCode");//人员工号
boolean yitongbu = resTwCourseRecordViews.stream().filter(tw->courseCode.equals(tw.get("COURSE_NO"))
&& employeeCode.equals(tw.get("EMP_NO"))).findAny().isPresent();
return !yitongbu;
}).collect(Collectors.toList());
案例二
Long count1 = twCategoryDValEntity.stream().map(en1 -> en1.getCatVal()).distinct().count();//去重后的大小;
案例三
直接获取list 集合中的一个字段集合
List<String> schoolId = SchoolNameList.getData().stream().map(u -> u.getId()).collect(Collectors.toList());