Java Collection Average average(Collection sizes)

Here you can find the source of average(Collection sizes)

Description

average

License

Open Source License

Declaration

public static double average(Collection<Double> sizes) 

Method Source Code

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

import java.util.Collection;

public class Main {
    public static double average(Collection<Double> sizes) {
        double sum = 0.0;
        int count = sizes.size();
        for (double size : sizes) {
            sum += size;//  ww w .  j  a  va2s.com
        }
        return count > 0 ? sum / count : 0.0;
    }
}

Related

  1. average(Collection a)
  2. average(Collection col)
  3. average(Collection values)
  4. average(Collection values)
  5. average(Collection values)
  6. average(Collection values)