Java Number Sum sumAsDouble(Iterable values)

Here you can find the source of sumAsDouble(Iterable values)

Description

Calculate the total sum of the numbers in the specified collection.

License

Apache License

Parameter

Parameter Description
values the list of values to sum.

Return

the sum of the values.

Declaration

public static double sumAsDouble(Iterable<? extends Number> values) 

Method Source Code

//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;
    }
}

Related

  1. sum(String str11, String str22)
  2. sum0ToN(int n)
  3. sum_quad(long max)
  4. sum_quad_endrec(long max)
  5. sumaMesFull(String sF, int n)
  6. SumDiffErr(float Term1Err, float Term2Err)
  7. sumDigits(String number)
  8. sumDivisors(int n)
  9. sumError(long samples, long count, double m2, double mean)