Here you can find the source of getAverage(List extends Number> list)
Parameter | Description |
---|---|
list | the list |
public static double getAverage(List<? extends Number> list)
//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(); } }