public final class DefaultCellComparator extends AbstractCellComparator
Verifies that the objects being compared are the same class. Looks to see if the objects being compared implement comparable and, if so, delegates to that; otherwise, implements a lexicographical compare function (i.e. string sorting). Uses the objects' toString() method and then compares the resulting strings. Note that null values are acceptable and are considered "smaller" than any non-null value.
Modifier and Type | Field and Description |
---|---|
static CellComparator |
INSTANCE
An instance of this class.
|
Modifier and Type | Method and Description |
---|---|
protected int |
nonNullCompare(java.lang.Object o1,
java.lang.Object o2)
Compares its two arguments for order.
|
compare
public static final CellComparator INSTANCE
protected int nonNullCompare(java.lang.Object o1, java.lang.Object o2)
AbstractCellComparator
Note that both objects are guaranteed to be non-null.
nonNullCompare
in class AbstractCellComparator
o1
- the first object to be comparedo2
- the second object to be comparedComparator.compare(Object, Object)