Class Composite<T>

java.lang.Object
org.dmfs.jems2.comparator.DelegatingComparator<T>
org.dmfs.jems2.comparator.Composite<T>
All Implemented Interfaces:
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)