List<AssociationVO> list = null;
//根据CategoryId分组
LinkedHashMap<String, List<AssociationVO>> map = list.stream()
.collect(
Collectors.groupingBy(AssociationVO::getCategoryId,
LinkedHashMap::new,
Collectors.toList()
)
);
Java8 Stream流 Collectors.groupingBy 分组统计详解
最新推荐文章于 2023-11-03 21:26:54 发布