2020
10-09
10-09
Java8 Stream Collectors收集器使用方法解析
Collectors.toMap:StudentstudentA=newStudent("20190001","小明");StudentstudentB=newStudent("20190002","小红");StudentstudentC=newStudent("20190003","小丁");//Function.identity()获取这个对象本身,那么结果就是Map<String,Student>即id->student//串行收集Stream.of(studentA,studentB,studentC).collect(Collectors.toMap(Student::getId,Function.identity()));//并发...
继续阅读 >