java8 stream groupingBy分组构造map数据字典
按照id分组构造 Map<String, SysDepart> Map<String, SysDepart> sysDepartMap = departList.stream().collect( Collectors.groupingBy(SysDepart::getId, Collectors.collectingAndThen( Collectors.toList(), sysDeparts -> sysDeparts.get(0))));
原创
2022-03-10 08:27:08 ·
2585 阅读 ·
0 评论