Here you can find the source of sum(List
Parameter | Description |
---|---|
numbers | the numbers to calculate the sum. |
public static double sum(List<Number> numbers)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { /**/* w w w . j a v a 2 s . c o 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 double sum(List<Number> numbers) { double sum = 0; for (Number value : numbers) { sum += value.doubleValue(); } return sum; } }