public class IntegerMinMax extends IntIntPair
BYFIRST_COMPARATOR, BYSECOND_COMPARATOR, first, second, SWAPPED_COMPARATOR
Constructor and Description |
---|
IntegerMinMax()
Constructor without starting values.
|
IntegerMinMax(int min,
int max)
Constructor with predefined minimum and maximum values.
|
Modifier and Type | Method and Description |
---|---|
int[] |
asIntArray()
Return minimum and maximum as array.
|
int |
getDiff()
Return the difference between minimum and maximum.
|
int |
getMax()
Get the current maximum.
|
int |
getMin()
Get the current minimum.
|
boolean |
isValid()
Test whether the result is defined.
|
static IntegerMinMax[] |
newArray(int size)
Generate a new array of initialized IntegerMinMax objects (with default
constructor)
|
void |
put(Collection<Integer> data)
Process a whole collection of Integer values.
|
void |
put(int data)
Process a single int value.
|
void |
put(int[] data)
Process a whole array of int values.
|
void |
reset()
Reset statistics.
|
compareSwappedTo, compareTo, equals, getFirst, getSecond, hashCode, setFirst, setSecond, toString
public IntegerMinMax()
Integer.MAX_VALUE
.
The maximum will be initialized to Integer.MIN_VALUE
.
So that the first data added will replace both.public IntegerMinMax(int min, int max)
min
- Minimum valuemax
- Maximum valuepublic void put(int data)
data
- New valuepublic void put(int[] data)
data
- Data to processpublic void put(Collection<Integer> data)
data
- Data to processpublic int getMin()
public int getMax()
public int getDiff()
public boolean isValid()
public int[] asIntArray()
public static IntegerMinMax[] newArray(int size)
size
- Array sizepublic void reset()