Java List Average getAverage(List numbers)

Here you can find the source of getAverage(List numbers)

Description

get Average

License

Open Source License

Declaration

public static <T extends Number> double getAverage(List<T> numbers) 

Method Source Code


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

import java.util.List;

public class Main {
    public static <T extends Number> double getAverage(List<T> numbers) {
        double avg = 0;
        for (T i : numbers)
            avg += i.doubleValue();/*  w  ww  .  j  a  v  a  2s  . co  m*/

        return avg / numbers.size();
    }
}

Related

  1. getAverage(List list)
  2. getAverage(List l)
  3. getAverage(List values)
  4. getAverage(List values)
  5. getAverage(List values)
  6. getAverageColour(List colours)
  7. getAverageDuration(List durations)
  8. getAverageInterval(List tapTimestamps, int n)
  9. getStandardDeviation(List longList, long average, long devByZero)