List<User> userList = new ArrayList<>(); User user1 = new User(); user1.setMoney("10.1");//double类型 userList.add(user1); User user2 = new User (); user2.setMoney("20.1");//double类型 userList.add(user2); BigDecimal sumMoney = userList.stream().map(User::getMoney).map(BigDecimal :: new).reduce(BigDecimal.ZERO,BigDecimal::add);
标签:user2,String,user1,list,userList,User,new,BigDecimal From: https://www.cnblogs.com/wuxu/p/17199085.html