java.util.Comparator<java.lang.Object>
public class NumberComparator
extends java.lang.Object
implements java.util.Comparator<java.lang.Object>
Modifier and Type | Field | Description |
---|---|---|
static ComparatorContext |
CONTEXT_ABSOLUTE |
Comparator Context to compare two values using the absolute value.
|
Modifier | Constructor | Description |
---|---|---|
protected |
NumberComparator() |
Constructor.
|
Modifier and Type | Method | Description |
---|---|---|
int |
compare(java.lang.Object o1,
java.lang.Object o2) |
Compares two Numbers.
|
static NumberComparator |
getInstance() |
Returns NumberComparator singleton.
|
boolean |
isAbsolute() |
Checks if if the values are compared using the absolute values.
|
void |
setAbsolute(boolean absolute) |
Sets the flag to compare the values using the absolute value.
|
public static final ComparatorContext CONTEXT_ABSOLUTE
protected NumberComparator()
public static NumberComparator getInstance()
public int compare(java.lang.Object o1, java.lang.Object o2)
compare
in interface java.util.Comparator<java.lang.Object>
o1
- the first object to be comparedo2
- the second object to be comparedpublic boolean isAbsolute()
public void setAbsolute(boolean absolute)
absolute
- true or false.