no.motif.iter.ordering.EnhancedComparator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of motif Show documentation
Show all versions of motif Show documentation
A library helping you to compose behavior from smaller parts.
The newest version!
package no.motif.iter.ordering;
import java.util.Comparator;
import no.motif.f.Predicate;
/**
* A {@link Comparator} augmented with various methods to refine its functionality.
*/
public interface EnhancedComparator extends Comparator {
/**
* @return Comparator
with reversed order.
*/
EnhancedComparator reversed();
/**
* @return a comparator which places elements matched by
* the given predicate first.
*/
EnhancedComparator first(Predicate super T> prioritized);
/**
* @return a comparator which places elements matched by
* the given predicate last.
*/
EnhancedComparator last(Predicate super T> last);
/**
* @return a null
-safe comparator which places
* null
-elements first.
*/
EnhancedComparator nullsFirst();
/**
* @return a null
-safe comparator which places
* null
-elements last.
*/
EnhancedComparator nullsLast();
}