attendantRecordDOS按订单号分类:
//key为订单号
Map<String, List<AttendantServiceRecordDO>> collect = attendantRecordDOS.stream().collect(Collectors.groupingBy(AttendantServiceRecordDO::getOrderSn));
订单号分类的Map实现
本文介绍了一种使用Java Stream API结合Collectors.groupingBy方法,根据订单号对AttendantServiceRecordDO对象进行分类的实现方式,将相同订单号的服务记录归类到同一个List中,便于后续的数据处理。
attendantRecordDOS按订单号分类:
//key为订单号
Map<String, List<AttendantServiceRecordDO>> collect = attendantRecordDOS.stream().collect(Collectors.groupingBy(AttendantServiceRecordDO::getOrderSn));
3195

被折叠的 条评论
为什么被折叠?