Java tutorial
//package com.java2s; import java.util.Collection; public class Main { public static Integer sum(Collection<Integer> collection) { if (collection == null || collection.size() == 0) { return 0; } Integer answer = 0; for (Integer value : collection) { answer += value; } return answer; } }