Here you can find the source of sum(List
public static double sum(List<Double> data)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static double sum(double[] data) { double v = 0.0; for (int i = 0; i < data.length; i++) v += data[i];/*ww w . j a v a 2 s .c o m*/ return v; } public static int sum(int[] data) { int v = 0; for (int i = 0; i < data.length; i++) v += data[i]; return v; } public static double sum(List<Double> data) { double v = 0.0; for (int i = 0; i < data.size(); i++) v += data.get(i); return v; } }