Java List Sum sum(List data)

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

Description

sum

License

Apache License

Declaration

public static double sum(List<Double> data) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.List;

public class Main {
    public static double sum(double[] data) {
        double v = 0.0;
        for (int i = 0; i < data.length; i++)
            v += data[i];/*ww w . j  a  v a 2  s  .c  o  m*/
        return v;
    }

    public static int sum(int[] data) {
        int v = 0;
        for (int i = 0; i < data.length; i++)
            v += data[i];
        return v;
    }

    public static double sum(List<Double> data) {
        double v = 0.0;
        for (int i = 0; i < data.size(); i++)
            v += data.get(i);
        return v;
    }
}

Related

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