All Downloads are FREE. Search and download functionalities are using the official Maven repository.

no.motif.iter.ordering.EnhancedComparator Maven / Gradle / Ivy

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 prioritized);


    /**
     * @return a comparator which places elements matched by
     *         the given predicate last.
     */
    EnhancedComparator last(Predicate 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();

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy