List of utility methods to do Collection Sum
int | sum(final Collection Sums the values in the collection. int sum = 0; for (Integer operand : values) { if (Integer.MAX_VALUE - sum < operand) { throw new Exception("Overflow."); sum += operand; return sum; ... |
Double | sumDouble(Collection sum Double Double result = 0.0; for (Double n : collection) { result += n; return result; |
String | summarizeCollection(Collection> collection, String collectionType, String elementType) summarize Collection if (collection == null) { return "null"; return collectionType + "<" + elementType + ">(size=" + collection.size() + ")"; |
Double | sumNumberCollection(Collection sum Number Collection double sum = 0.0; for (T t : numbers) { sum += t.doubleValue(); return sum; |