public class NumberComparator extends Object implements Comparator<Object>
Modifier and Type | Field and Description |
---|---|
static ComparatorContext |
CONTEXT_ABSOLUTE
Comparator Context to compare two values using the absolute value.
|
Modifier | Constructor and Description |
---|---|
protected |
NumberComparator()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
compare(Object o1,
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals
public static final ComparatorContext CONTEXT_ABSOLUTE
protected NumberComparator()
public static NumberComparator getInstance()
public int compare(Object o1, Object o2)
compare
in interface Comparator<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.