分组
List<Dict> dictList = dictService.findAll();
Map<String,Map<String,Long>> dictMap = new HashMap<>();
if (org.apache.commons.collections.CollectionUtils.isNotEmpty(dictList)) {
dictMap = dictList.stream().collect(Collectors.groupingBy(Dict::getLineCode, Collectors.toMap(Dict::getCodeName,Dict::getId)));
}
过滤
Map<Long, Set<MeasurementValue>> resultFliter = result.entrySet().stream()
.filter(entity -> entity.getKey() <= stopTime && entity.getKey() > startTime)
.collect(Collectors.toMap(Entry::getKey, Entry::getValue));
Map<Long, String> umVendorMap =
umVendors.stream().collect(Collectors.toMap(UmVendorDef::getObjectId, UmVendorDef::getName));