List<EarlyWarningRuleDO> allPriorityList = getEarlyWarningRuleList();
log.info("oringinal" + allPriorityList.toString());
List<EarlyWarningRuleDO> lowPriorityList = allPriorityList.stream().filter(earlyWarningRuleDO -> 2 == earlyWarningRuleDO.getPriority()).collect(Collectors.toList());
log.info("lowPriorityList" + lowPriorityList.toString());
Map<String,List<EarlyWarningRuleDO>> maplowPriorityList = lowPriorityList.stream().collect(Collectors.groupingBy(EarlyWarningRuleDO::getOperatorCompanyId));
log.info("maplowPriorityList" + maplowPriorityList.toString());
Map<String,EarlyWarningRuleDO > maplowPriorityEarlyWarningRuleDO = lowPriorityList.stream().collect(Collectors.toMap(EarlyWarningRuleDO::getRuleType, earlyWarningRuleDO ->earlyWarningRuleDO));
log.info("maplowPriorityEarlyWarningRuleDO" + maplowPriorityEarlyWarningRuleDO.toString());
Stream 的一些用法
最新推荐文章于 2024-01-17 15:03:13 发布