最近一直用到,特此记录一下
int ageSum = distributionOrders.stream().collect(Collectors.summingInt(User::getAge)); BigDecimal paymentPrice = distributionOrders.stream().map(User::getMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
最近一直用到,特此记录一下
int ageSum = distributionOrders.stream().collect(Collectors.summingInt(User::getAge)); BigDecimal paymentPrice = distributionOrders.stream().map(User::getMoney).reduce(BigDecimal.ZERO, BigDecimal::add);