Java mean mean(List a)

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

Description

mean

License

Open Source License

Declaration

public static double mean(List<Double> a) 

Method Source Code


//package com.java2s;
// under certain conditions; for more information please see LICENSE.txt

import java.util.*;

public class Main {
    public static double mean(List<Double> a) {
        double sum = sum(a);
        double mean = 0;
        mean = sum / (a.size() * 1.0);/*ww w .j ava 2  s.c  o  m*/
        return mean;
    }

    public static double sum(List<Double> a) {
        if (a.size() > 0) {
            double sum = 0;

            for (Double i : a) {
                sum += i;
            }
            return sum;
        }
        return 0;
    }
}

Related

  1. mean(int[] array)
  2. mean(int[] input)
  3. mean(int[] values)
  4. mean(int[] values, int max)
  5. mean(Integer[] values)
  6. mean(List values)
  7. mean(long[] values)
  8. mean(Number[] array)
  9. Mean(Object in)