runeflobakk/motif

A Comparator API

runeflobakk opened this issue · 1 comments

It's already possible to create Comparators using a Fn<?, ? extends Comparable<?>>. It should return an interface (say EnhancedComparator<T> or similar) with methods to create modifications based on the original Comparator.

Suggestion:

interface EnhancedComparator<T> extends Comparator<T> {
   EnhancedComparator<T> descending();
   EnhancedComparator<T> nullsFirst(); //nullsafe comparator
   EnhancedComparator<T> nullsLast();  //nullsafe comparator
}

Pushed to dev branch e2e547e