Here you can find the source of sum(List
public static double sum(List<Double> a)
//package com.java2s; // under certain conditions; for more information please see LICENSE.txt import java.util.*; public class Main { public static double sum(List<Double> a) { if (a.size() > 0) { double sum = 0; for (Double i : a) { sum += i;/*from w w w . ja v a 2s .c om*/ } return sum; } return 0; } }