Here you can find the source of sum(List
Parameter | Description |
---|---|
numbers | the numbers to calculate the sum. |
public static BigDecimal sum(List<BigDecimal> numbers)
//package com.java2s; //License from project: Open Source License import java.math.BigDecimal; import java.util.List; public class Main { /**/*from w w w . j ava 2 s .co m*/ * Returns the sum number in the numbers list. * * @param numbers the numbers to calculate the sum. * @return the sum of the numbers. */ public static BigDecimal sum(List<BigDecimal> numbers) { BigDecimal sum = new BigDecimal(0); for (BigDecimal bigDecimal : numbers) { sum = sum.add(bigDecimal); } return sum; } }