Java examples for java.util:Collection Search
Returns the combined value of all entries in the Integer Collection
//package com.java2s; import java.util.Collection; public class Main { public static void main(String[] argv) { Collection list = java.util.Arrays.asList("asdf", "java2s.com"); System.out.println(valueTotal(list)); }/* w w w.ja v a 2 s. com*/ /** * Returns the combined value of all entries in the * Integer Collection * * @param list List * @return Integer */ public static int valueTotal(Collection<Integer> list) { int total = 0; for (Integer value : list) { total += value; } return total; } }