Here you can find the source of mean(List
Parameter | Description |
---|---|
list | a parameter |
public static Double mean(List<Double> list)
//package com.java2s; /*L/* ww w. j av a2 s. c om*/ * Copyright SAIC * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/stats-analysis/LICENSE.txt for details. */ import java.util.Collections; import java.util.List; public class Main { /** * This method returns you the mean value for a List of Doubles * @param list * @return */ public static Double mean(List<Double> list) { double sum = 0; // sum of all the elements if (list == null) { list = Collections.emptyList(); } for (Double i : list) { sum += i; } return sum / list.size(); } }