Here you can find the source of sum(List
Parameter | Description |
---|---|
list | a parameter |
public static Integer sum(List<Integer> list)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { /**/*ww w .ja v a 2s .c o m*/ * @param list * @return Integer */ public static Integer sum(List<Integer> list) { Integer result = 0; for (Integer it : list) { result += it; } return result; } }