获得徽章 11
- #每日一题# day1
通过流操作将list分组成map
List<Person> personList = new ArrayList<>();
personList.add(new Person("aa", 20));
personList.add(new Person("bb", 25));
personList.add(new Person("cc", 30));
personList.add(new Person("dd", 25));
Map<Integer, List<Person>> result = personList.stream()
.collect(Collectors.groupingBy(Person::getAge));展开评论点赞
![[做鬼脸]](http://lf-web-assets.juejin.cn/obj/juejin-web/xitu_juejin_web/img/jj_emoji_62.d7ca811.png)