CarpenterLee / JavaLambdaInternals

深入理解Java函数式编程和Streams API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

疑问

liyiming-china opened this issue · comments

Map<Department, Integer> totalByDept = employees.stream()
.collect(Collectors.groupingBy(Employee::getDepartment,
Collectors.counting()));// 下游收集器
Collectors.counting()怎么返回Integer

Collectors.counting() 改为 Collectors.summingInt(e -> 1))