Here you can find the source of sum(List
private static int sum(List<Integer> l)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { private static int sum(List<Integer> l) { int sum = 0; for (int i : l) { sum += i;/* w w w . j av a 2 s. c o m*/ } return sum; } }