Map<CxFeeAmountType, BigDecimal> feeMap = feeBills.stream()
.filter(receipt -> receipt.getWithtaxAmount() != null)
.collect(Collectors.groupingBy(CxFeeAmountType::getType,
Collectors.reducing(BigDecimal.ZERO, CxFeeBillDTO::getWithtaxAmount, BigDecimal::add)));
複製代碼
由於會報空指針異常,因此最好先過濾掉爲null的數據.bash