investorList为List集合 每个对象都包含InvestMoney属性 CommonUtils.isNumeric为判断该属性是否为数字的方法 Double sum = investorList.stream().mapToDouble(n -> CommonUtils.isNumeric(n.getInvestMoney()) ?
Double.parseDouble(n.getInvestMoney()) : 0.00).summaryStatistics().getSum();
java8 集合某属性求和
猜你喜欢
转载自www.cnblogs.com/rain-in-summer/p/10844141.html
今日推荐
周排行