Package org.onosproject.ui.table.cell
Class DefaultCellComparator
- java.lang.Object
-
- org.onosproject.ui.table.cell.AbstractCellComparator
-
- org.onosproject.ui.table.cell.DefaultCellComparator
-
- All Implemented Interfaces:
CellComparator
public final class DefaultCellComparator extends AbstractCellComparator
A default cell comparator.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.
-
-
Field Summary
Fields Modifier and Type Field Description static CellComparator
INSTANCE
An instance of this class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
nonNullCompare(Object o1, Object o2)
Compares its two arguments for order.-
Methods inherited from class org.onosproject.ui.table.cell.AbstractCellComparator
compare
-
-
-
-
Field Detail
-
INSTANCE
public static final CellComparator INSTANCE
An instance of this class.
-
-
Method Detail
-
nonNullCompare
protected int nonNullCompare(Object o1, Object o2)
Description copied from class:AbstractCellComparator
Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.Note that both objects are guaranteed to be non-null.
- Specified by:
nonNullCompare
in classAbstractCellComparator
- Parameters:
o1
- the first object to be comparedo2
- the second object to be compared- Returns:
- an integer representing relative ordering
- See Also:
Comparator.compare(Object, Object)
-
-