Here you can find the source of sumAsDouble(Iterable extends Number> values)
Parameter | Description |
---|---|
values | the list of values to sum. |
public static double sumAsDouble(Iterable<? extends Number> values)
//package com.java2s; //License from project: Apache License public class Main { /**/*from w w w . ja v a 2 s. co m*/ * Calculate the total sum of the numbers in the specified collection. * @param values the list of values to sum. * @return the sum of the values. */ public static double sumAsDouble(Iterable<? extends Number> values) { double total = 0; for (Number value : values) { total += value.doubleValue(); } return total; } }