Class Composite<T>

  • All Implemented Interfaces:
    java.util.Comparator<T>

    public final class Composite<T>
    extends DelegatingComparator<T>
    A Comparator which delegates the comparison of two instances to other Comparators until the first one returns a non-zero result.

    The result is the same as repeatedly calling "thenComparing" on the Comparators, i.e. the following two expressions return the same Comparator:

         comparatorA.thenComparing(comparatorB).thenComparing(comparatorC)
    
         new Composite<>(comparatorA, comparatorB, comparatorC)
     
    • Constructor Summary

      Constructors 
      Constructor Description
      Composite​(java.lang.Iterable<? extends java.util.Comparator<? super T>> delegates)  
      Composite​(java.util.Comparator<? super T>... delegates)  
    • Method Summary

      • 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

      • Composite

        @SafeVarargs
        public Composite​(java.util.Comparator<? super T>... delegates)
      • Composite

        public Composite​(java.lang.Iterable<? extends java.util.Comparator<? super T>> delegates)