Java ArrayList Sum sum(ArrayList a)

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

Description

sum

License

Open Source License

Declaration

public static <T extends Number> double sum(ArrayList<T> a) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

public class Main {
    public static <T extends Number> double sum(ArrayList<T> a) {
        double sum = 0;
        for (int i = 0; i < a.size(); i++)
            sum += a.get(i).doubleValue();
        return sum;
    }// w w  w.j av  a  2  s .co  m
}

Related

  1. sum(ArrayList values)
  2. sum(ArrayList values)
  3. Sum(ArrayList values)
  4. sumInColumns(ArrayList lines)
  5. sumVector(ArrayList v1, ArrayList v2)