jdk1.8 stream 求和
BigDecimal:
BigDecimal bb =list.stream().map(Plan::getAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
int、double、long:
double max = list.stream().mapToDouble(User::getHeight).sum();
BigDecimal promoTotalMoney = goodsInfoList.stream().filter(g -> g.isPromoFlag()).map(item -> BigDecimal.valueOf(item.getGoodsPrice()).multiply(BigDecimal.valueOf(item.getGoodsCnt()))).reduce(BigDecimal.ZERO, BigDecimal::add);