Java List Average getAverage(List l)

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

Description

Computes list average.

License

Apache License

Parameter

Parameter Description
l a parameter

Return

0 if the list is empty!

Declaration

public static Double getAverage(List<Double> l) 

Method Source Code

//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();
    }
}

Related

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