T
- Data typepublic class MinMax<T extends Comparable<? super T>> extends Pair<T,T>
Constructor and Description |
---|
MinMax()
Constructor without starting values.
|
MinMax(T min,
T max)
Constructor with predefined minimum and maximum values.
|
Modifier and Type | Method and Description |
---|---|
Object[] |
asArray()
Return minimum and maximum as array.
|
T |
getMax()
Get the current maximum.
|
T |
getMin()
Get the current minimum.
|
boolean |
isValid()
Test if we have seen any data (and thus have a useful minimum and maximum).
|
static <N extends Comparable<N>> |
newArray(int size)
New array of MinMax objects for a given type.
|
void |
put(Iterable<T> data)
Process a whole collection of values.
|
void |
put(SortedSet<T> data)
Process a whole collection of values.
|
void |
put(T data)
Process a single value.
|
void |
put(T[] data)
Process a whole array of values.
|
public MinMax()
null
.
The maximum will be initialized to null
.public void put(T data)
data
- New valuepublic void put(T[] data)
data
- Data to processpublic void put(Iterable<T> data)
data
- Data to processpublic void put(SortedSet<T> data)
data
- Data to processpublic T getMin()
public T getMax()
public boolean isValid()
true
iff min != null and max != null.public Object[] asArray()
public static <N extends Comparable<N>> MinMax<N>[] newArray(int size)
N
- Number type.size
- Size.