欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

list分组

程序员文章站 2022-03-23 22:12:11
...
https://blog.csdn.net/ji519974770/article/details/83549240


public Map<String, List<Student>> groupList(List<Student> students) {
Map<String, List<Student>> map = students.stream().collect(Collectors.groupingBy(Student::getName));
return map;
}