stream对list进行分组,并对分组后的数据进行map操作获取其中的某一项属性值

Map<String, List> map = list.stream().collect(Collectors.groupingBy(CourseTeacherDTO::getCourseId, Collectors.mapping(CourseTeacherDTO::getName, Collectors.toList())));

posted @ 2021-10-22 14:49  菜鸟Blue  阅读(2040)  评论(0)    收藏  举报