stream() BigDecimal类型求和
//List对象集合
List<MOrderGoods> mOrderGoodsList1;
//getActualPayTotalAmount属性类型为BigDecimal
BigDecimal invoiceAmount = mOrderGoodsList1.stream().map(MOrderGoods::getActualPayTotalAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
stream() int、double、long 类型求和
//List对象集合
List<MOrderGoods> mOrderGoodsList1;
//getActualPayTotalAmount属性类型为double
double max = list.stream().mapToDouble(User::getHeight).sum();
//其他类型秩序更改对应的mapToLong 等相关方法与接受参数类型即可