Java Utililty Methods Collection Mean

List of utility methods to do Collection Mean

Description

The list of methods to do Collection Mean are organized into topic(s).

Method

Doublemean(Collection dist)
mean
if (dist != null && !dist.isEmpty()) {
    double sum = 0d;
    int count = 0;
    for (Double val : dist) {
        if (val != null) {
            sum += val;
            count++;
    return count > 0 ? sum / count : null;
return null;
doublemean(Collection vector)
mean
return mean(vector.toArray(new Number[vector.size()]));
doublemean(final Collection values)
Calculates the mean of a Collection
return sum(values) / values.size();
doublemean(final Collection values)
mean
final double total = sum(values);
return total / values.size();
double[]meanAndVariance(Collection vector)
mean And Variance
return meanAndVariance(vector.toArray(new Number[vector.size()]), true);