导航

 
Map<String, Map<String, EnergyDosageSummary>> list2map(List<EnergyDosageSummary> list) {
list = list.stream().sorted(Comparator.comparing(EnergyDosageSummary::getCostCenter)).collect(Collectors.toList());
//costCenter-feeType-bean
Map<String, Map<String, EnergyDosageSummary>> resultMap = new HashMap<>(list.size());
for (EnergyDosageSummary summary : list) {
resultMap.computeIfAbsent(summary.getCostCenter(), key -> new HashMap<>()).put(summary.getFeeType(), summary);
}
return resultMap;
}
posted on 2023-04-06 09:56  一棵二叉树  阅读(91)  评论(0编辑  收藏  举报