Class DefaultCellComparator

  • All Implemented Interfaces:

    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 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 class AbstractCellComparator
        o1 - the first object to be compared
        o2 - the second object to be compared
        an integer representing relative ordering
        See Also:, Object)