Java List Mean mean(List data)

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

Description

mean

License

Open Source License

Declaration

public static double mean(List<? extends Number> data) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2014 Gabriel Skantze./*  ww  w.  ja v  a  2  s  .  c om*/
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 * 
 * Contributors:
 *     Gabriel Skantze - initial API and implementation
 ******************************************************************************/

import java.util.List;

public class Main {
    public static double mean(List<? extends Number> data) {
        double mean = 0;
        for (Number pd : data) {
            mean += pd.doubleValue() / data.size();
        }
        return mean;
    }
}

Related

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