Java List Average average(List observations)

Here you can find the source of average(List observations)

Description

average

License

Open Source License

Declaration

public static double average(List<Double> observations) 

Method Source Code


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

import java.util.*;

public class Main {
    public static double average(List<Double> observations) {
        double total = 0.0;
        for (double d : observations) {
            total += d;//from  w  ww. j  a  v a  2 s  . c o m
        }
        return total / observations.size();
    }

    public static double average(double[] data) {
        double total = 0.0;
        for (double d : data) {
            total += d;
        }
        return total / data.length;
    }
}

Related

  1. average(final List vals, final int maxI)
  2. average(List collected)
  3. average(List arr)
  4. average(List list)
  5. average(List numbers)
  6. average(List collection)
  7. averageDouble(final List values)
  8. averageLog(List logList)
  9. averageValue(List oper)