通过部门名称分组后,累加部门成本
Map<String, Optional<BigDecimal>> deptInfo = profits.stream().collect(Collectors.groupingBy(Dept::getDeptName, Collectors.mapping(Dept::getAmount, Collectors.reducing(BigDecimal::add))))
Map<String, Optional<BigDecimal>> deptInfo = profits.stream().collect(Collectors.groupingBy(Dept::getDeptName, Collectors.mapping(Dept::getAmount, Collectors.reducing(BigDecimal::add))))