BigDecimal
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:
BigDecimal bb =list.stream().map(Plan::getAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
double max = list.stream().mapToDouble(User::getHeight).sum();
本文标题:Java Stream流之求和
本文链接:https://www.haomeiwen.com/subject/shncohtx.html
网友评论