public class StatisticsUtils
extends java.lang.Object
Constructor and Description |
---|
StatisticsUtils() |
Modifier and Type | Method and Description |
---|---|
static double |
getAverage(java.util.Collection<? extends java.lang.Number> list)
Calculates the average from a collection of numeric values.
|
static <T extends java.lang.Number> |
getPercentiles(java.util.Collection<? extends T> values,
double... percentiles)
Gets percentile values from a collection of numeric values.
|
public static double getAverage(java.util.Collection<? extends java.lang.Number> list)
list
- List of numbers to average againstpublic static <T extends java.lang.Number> java.util.Map<java.lang.Double,T> getPercentiles(java.util.Collection<? extends T> values, double... percentiles)
The returned map's keys correspond exactly to the percentiles provided. Iterating over the returned map will iterate in order of the requested percentiles as well.
T
- Specific number type contained in the collectionvalues
- A non-empty collection of numbers to examine for percentilespercentiles
- Percentiles requested, any decimal values between 0 and 100 (inclusive)