Java List Mean mean(final List list)

Here you can find the source of mean(final List list)

Description

Gets the average.

License

GNU General Public License

Parameter

Parameter Description
list the list

Return

the average

Declaration

public static double mean(final List<Double> list) 

Method Source Code

//package com.java2s;
/*/*from  www.  j  av  a  2s .co m*/
 * Title:        CloudSim Toolkit
 * Description:  CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
 * Licence:      GPL - http://www.gnu.org/copyleft/gpl.html
 *
 * Copyright (c) 2009-2012, The University of Melbourne, Australia
 */

import java.util.List;

public class Main {
    /**
     * Gets the average.
     * 
     * @param list the list
     * 
     * @return the average
     */
    public static double mean(final List<Double> list) {
        double sum = 0;
        for (Double number : list) {
            sum += number;
        }
        return sum / list.size();
    }
}

Related

  1. getMean(List list)
  2. getStandardDeviation(double meanValue, List values)
  3. getStandardDeviation(List doubles, Double mean)
  4. getStandardDeviationOfMean(List doubles)
  5. mean(double[] list)
  6. mean(List data)
  7. mean(List nums, int start, int size)
  8. mean(List data)
  9. mean(List list)