Class AbstractChainedSortOrderComparator<T>

  • Type Parameters:
    T - The type of objects that may be compared by this comparator.
    All Implemented Interfaces:
    SortOrderComparator<T>, java.util.Comparator<T>

    public abstract class AbstractChainedSortOrderComparator<T>
    extends AbstractSortOrderComparator<T>
    A comparator that can can be chained for subordinate sorting in ascending or descending order.

    Subclasses should delegate to the subordinate comparator if the compared objects are not identical yet evaluate as equal, or if sufficient information is absent for sorting on both objects.

    No checks are made to prevent circular chaining, which could create infinite loops.

    Author:
    Garret Wilson
    See Also:
    SortOrder
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Comparator<T> getSubordinateComparator()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Comparator

        equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
    • Constructor Detail

      • AbstractChainedSortOrderComparator

        public AbstractChainedSortOrderComparator​(SortOrder sortOrder,
                                                  java.util.Comparator<T> subordinateComparator)
        Sort order and subordinate comparator constructor.
        Parameters:
        sortOrder - The order in which to perform comparisons.
        subordinateComparator - The comparator to perform subordinate sorting.
        Throws:
        java.lang.NullPointerException - if the given subordinate comparator and/or sort order is null.
    • Method Detail

      • getSubordinateComparator

        public java.util.Comparator<T> getSubordinateComparator()
        Returns:
        The comparator to perform subordinate sorting.