Here you can find the source of getAverage(List
Parameter | Description |
---|---|
l | a parameter |
public static Double getAverage(List<Double> l)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { /**// w w w . ja v a 2 s . c o m * Computes list average. * @param l * @return 0 if the list is empty! */ public static Double getAverage(List<Double> l) { Double sumc = 0.0; for (Double num : l) sumc += num; return sumc / l.size(); } }