Java List Sum sum(List a)

Here you can find the source of sum(List a)

Description

sum

License

Open Source License

Declaration

public static double sum(List<Double> a) 

Method Source Code


//package com.java2s;
// under certain conditions; for more information please see LICENSE.txt

import java.util.*;

public class Main {
    public static double sum(List<Double> a) {
        if (a.size() > 0) {
            double sum = 0;

            for (Double i : a) {
                sum += i;/*from w  w  w .  ja v  a  2s  .c  om*/
            }
            return sum;
        }
        return 0;
    }
}

Related

  1. sum(final List list1, final List list2)
  2. sum(final List list)
  3. sum(final List list)
  4. sum(int[] list)
  5. sum(List list)
  6. sum(List data)
  7. sum(List scores)
  8. sum(List vals)
  9. sum(List l)