Java List Average getAverage(List list)

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

Description

Gets the average.

License

LGPL

Parameter

Parameter Description
list the list

Return

the average

Declaration

public static double getAverage(List<? extends Number> list) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import java.util.List;

public class Main {
    /**//from ww  w  .ja  v a2 s .  co m
     * Gets the average.
     *
     * @param list the list
     *
     * @return the average
     */
    public static double getAverage(List<? extends Number> list) {
        Double total = 0.0;
        for (Number item : list) {
            total += item.doubleValue();
        }
        return total / list.size();
    }
}

Related

  1. averageValue(List oper)
  2. calculateAverage(final List durations)
  3. calculateAverage(List list)
  4. computeAverage(List aList)
  5. getAverage(int period, List timeline)
  6. getAverage(List l)
  7. getAverage(List values)
  8. getAverage(List values)
  9. getAverage(List values)