今天就学了一个合计贴一下 省的下一次找不到
Long subScore = new Long(0);
List<ExamPaperAnswerRecord> examPaperAnswerRecords = list.getExamPaperAnswerRecords();
Optional aa= examPaperAnswerRecords.stream().map(ExamPaperAnswerRecord::getScore).reduce((acc, item) -> {
acc += item;
return acc;
});
Long val = (Long) aa.get();
decimal 的可以这样写
BigDecimal dueAmount = list.stream().map(DepositAudit::getDueAmount).reduce(BigDecimal.ZERO, BigDecimal::add);