筛选
List<ObjectModel> collent = objectModels.stream()
.filter(a -> a.getStatus() != 4 && !a.getP_object_id().equals("-1")).collect(Collectors.toList());
list转map<String,String>
Map<String, String> objectUnit = objectList.stream()
.collect(Collectors.toMap(ObjectModel::getId, ObjectModel::getDurationUnit, (key1, key2) -> key2));
list转map<String,objectModel>
Map<String, ObjectModel> objectModelMaps =
allObjectByObjectId.stream().collect(Collectors.toMap(ObjectModel::getId, a -> a, (k1, k2) -> k1));
list转map<String,List<KerResult,>>
Map<String, List<KeyResult>> keyResultMaps = keyResultList1.stream()
.collect(Collectors.groupingBy(KeyResult::getObjectId));
list转map<String,List>
Map<Long, List<Long>> spIdAndUpIdList= qbBasicCheckResultEntityList.stream().distinct()
.collect(Collectors.groupingBy(QbBasicCheckDetailEntity::getSpId,
Collectors.mapping(QbBasicCheckDetailEntity::getUpId, Collectors.toList())));
将map的value放入list
financeMap.forEach((key,value)->{ amountList.add(value); });
list求和
List<BigDecimal> amountList = projectFinanceRecordList.stream().map(ProjectFinanceRecord::getAmount).collect(Collectors.toList());
BigDecimal sum = amountList.stream().reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
分页
list = list .stream().skip((pages.getCurrent() - 1) * pages.getSize()).limit(pages.getSize()).collect(Collectors.toList());