Class ChainableComparator<T>

  • Type Parameters:
    T - the generic type of the object that will be compared
    All Implemented Interfaces:
    java.io.Serializable, java.util.Comparator<T>

    public class ChainableComparator<T>
    extends org.apache.commons.collections4.comparators.ComparatorChain<T>
    The class ChainableComparator extends the ComparatorChain and provides factory methods for create ChainableComparator objects.
    See Also:
    ComparatorChain , Serialized Form
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> ChainableComparator<T> of()
      Factory method to create a new chainable Comparator object.
      static <T> ChainableComparator<T> of​(java.util.Comparator<T> comparator)
      Factory method to create a new chainable Comparator object from the given Comparator object.
      static <T> ChainableComparator<T> of​(java.util.Comparator<T> comparator, boolean reverse)
      Factory method to create a new chainable Comparator object from the given Comparator object and the given reverse flag.
      static <T> ChainableComparator<T> of​(java.util.List<java.util.Comparator<T>> list)
      Factory method to create a new chainable Comparator object from the given List of Comparator objects.
      static <T> ChainableComparator<T> of​(java.util.List<java.util.Comparator<T>> list, java.util.BitSet bits)
      Factory method to create a new chainable Comparator object from the given List of Comparator objects.
      • Methods inherited from class org.apache.commons.collections4.comparators.ComparatorChain

        addComparator, addComparator, compare, equals, hashCode, isLocked, setComparator, setComparator, setForwardSort, setReverseSort, size
      • Methods inherited from class java.lang.Object

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

        reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
    • Method Detail

      • of

        public static <T> ChainableComparator<T> of()
        Factory method to create a new chainable Comparator object.
        Type Parameters:
        T - the generic type of the Comparator object that will be compared
        Returns:
        the new chainable Comparator object
        See Also:
        ComparatorChain
      • of

        public static <T> ChainableComparator<T> of​(java.util.Comparator<T> comparator)
        Factory method to create a new chainable Comparator object from the given Comparator object.
        Type Parameters:
        T - the generic type of the Comparator object that will be compared
        Parameters:
        comparator - the Comparator object that will be in the chain
        Returns:
        the new chainable Comparator object
        See Also:
        ComparatorChain
      • of

        public static <T> ChainableComparator<T> of​(java.util.Comparator<T> comparator,
                                                    boolean reverse)
        Factory method to create a new chainable Comparator object from the given Comparator object and the given reverse flag.
        Type Parameters:
        T - the generic type of the Comparator object that will be compared
        Parameters:
        comparator - the Comparator object that will be in the chain
        reverse - the reverse flag
        Returns:
        the new chainable Comparator object
        See Also:
        ComparatorChain
      • of

        public static <T> ChainableComparator<T> of​(java.util.List<java.util.Comparator<T>> list)
        Factory method to create a new chainable Comparator object from the given List of Comparator objects.
        Type Parameters:
        T - the generic type of the Comparator object that will be compared
        Parameters:
        list - the list with the Comparator objects.
        Returns:
        the new chainable Comparator object
        See Also:
        ComparatorChain
      • of

        public static <T> ChainableComparator<T> of​(java.util.List<java.util.Comparator<T>> list,
                                                    java.util.BitSet bits)
        Factory method to create a new chainable Comparator object from the given List of Comparator objects.
        Type Parameters:
        T - the generic type of the Comparator object that will be compared
        Parameters:
        list - the list with the Comparator objects.
        bits - Sort order for each Comparator. Extra bits are ignored, unless extra Comparators are added by another method.
        Returns:
        the new chainable Comparator object
        See Also:
        ComparatorChain