//对于Map的值,先把PutTarget转换为CoursePutApply,再调用toList()
Map<String, List<CoursePutApply>> result1 = this.putTargets.stream()
.collect(
Collectors.groupingBy(
PutTarget::getCity, Collectors.mapping((PutTarget putTarget) -> new CoursePutApply(), toList())
)
);
//对于Map的值,先调用toList(), 再把PutTarget转换为CoursePutApply
Map<String, CoursePutApply> result2 = this.putTargets.stream()
.collect(
Collectors.groupingBy(
PutTarget::getCity, Collectors.collectingAndThen(toList(), (List<PutTarget> list) -> newCoursePutApply(this.courseId, list))
)
);
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。