public class MinMaxAv
extends java.lang.Object
| Constructor and Description |
|---|
MinMaxAv() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(double value)
Add a value to the set.
|
double |
getAverage()
Get the average of values in the set.
|
int |
getCount()
Get the number of values in the set.
|
double |
getMaximum()
Get the maximum value of the set.
|
double |
getMinimum()
Get the minimum value of the set.
|
boolean |
isValid()
Is this item valid?
|
static MinMaxAv |
of(byte... values)
Get the minimum, maximum and average of the given array of values.
|
static MinMaxAv |
of(char... values)
Get the minimum, maximum and average of the given array of values.
|
static MinMaxAv |
of(double... values)
Get the minimum, maximum and average of the given array of values.
|
static MinMaxAv |
of(float... values)
Get the minimum, maximum and average of the given array of values.
|
static MinMaxAv |
of(int... values)
Get the minimum, maximum and average of the given array of values.
|
static MinMaxAv |
of(java.lang.Iterable<? extends java.lang.Number> values)
Get the minimum, maximum and average of the given iterable of numeric values.
|
static <T,N extends java.lang.Number> |
of(java.lang.Iterable<T> elements,
java.util.function.Function<? super T,? extends N> extractor)
Get the minimum, maximum and average of the given iterable of generic elements.
|
static MinMaxAv |
of(long... values)
Get the minimum, maximum and average of the given array of values.
|
static MinMaxAv |
of(short... values)
Get the minimum, maximum and average of the given array of values.
|
public void add(double value)
value - value to addpublic boolean isValid()
true if at least one value was addedfalse if the set of values is emptypublic double getMinimum()
public double getMaximum()
public int getCount()
public double getAverage()
NaN if this set is not valid@NotNull public static MinMaxAv of(@NotNull double... values)
values - double array@NotNull public static MinMaxAv of(@NotNull float... values)
values - float array@NotNull public static MinMaxAv of(@NotNull long... values)
values - long array@NotNull public static MinMaxAv of(@NotNull int... values)
values - int array@NotNull public static MinMaxAv of(@NotNull short... values)
values - short array@NotNull public static MinMaxAv of(@NotNull byte... values)
values - byte array@NotNull public static MinMaxAv of(@NotNull char... values)
values - char array@NotNull public static MinMaxAv of(@NotNull java.lang.Iterable<? extends java.lang.Number> values)
values - iterable of numbers@NotNull public static <T,N extends java.lang.Number> MinMaxAv of(@NotNull java.lang.Iterable<T> elements, @NotNull java.util.function.Function<? super T,? extends N> extractor)
T - element typeN - type of number from which the minimum, maximum, and average is calculatedelements - iterable of elementsextractor - function which extracts a numeric value from a value