java 一个list 根据某个字段 一次性获取到多个list


方法:stream流中的
groupingBy方法

代码实现:
Map<String, List<DistribsunStationListVO>> collect = distribsunStationListList.stream().collect(Collectors.groupingBy(DistribsunStationListVO::getScheduleScopeid))
DistribsunStationListVO::getScheduleScopeid 表示按照哪个字段进行分组
Map<String, List<DistribsunStationListVO>>   string 的值 就是 getScheduleScopeid 

 

posted @   jiuchengi  阅读(696)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库
· SQL Server 2025 AI相关能力初探
点击右上角即可分享
微信分享提示