Class SortBy<A,B extends Comparable<B>>
java.lang.Object
com.jnape.palatable.lambda.functions.builtin.fn2.SortBy<A,B>
- Type Parameters:
A
- the input Iterable and output List element typeB
- the mapped Comparable type
- All Implemented Interfaces:
Fn1<Fn1<? super A,
,? extends B>, Fn1<Iterable<A>, List<A>>> Fn2<Fn1<? super A,
,? extends B>, Iterable<A>, List<A>> Applicative<Fn1<Iterable<A>,
,List<A>>, Fn1<Fn1<? super A, ? extends B>, ?>> Cartesian<Fn1<? super A,
,? extends B>, Fn1<Iterable<A>, List<A>>, Fn1<?, ?>> Cocartesian<Fn1<? super A,
,? extends B>, Fn1<Iterable<A>, List<A>>, Fn1<?, ?>> Contravariant<Fn1<? super A,
,? extends B>, Profunctor<?, Fn1<Iterable<A>, List<A>>, Fn1<?, ?>>> Functor<Fn1<Iterable<A>,
,List<A>>, Fn1<Fn1<? super A, ? extends B>, ?>> Profunctor<Fn1<? super A,
,? extends B>, Fn1<Iterable<A>, List<A>>, Fn1<?, ?>> Monad<Fn1<Iterable<A>,
,List<A>>, Fn1<Fn1<? super A, ? extends B>, ?>> MonadReader<Fn1<? super A,
,? extends B>, Fn1<Iterable<A>, List<A>>, Fn1<Fn1<? super A, ? extends B>, ?>> MonadRec<Fn1<Iterable<A>,
,List<A>>, Fn1<Fn1<? super A, ? extends B>, ?>> MonadWriter<Fn1<? super A,
? extends B>, Fn1<Iterable<A>, List<A>>, Fn1<Fn1<? super A, ? extends B>, ?>>
public final class SortBy<A,B extends Comparable<B>>
extends Object
implements Fn2<Fn1<? super A,? extends B>,Iterable<A>,List<A>>
Given an
Iterable
and some mapping function from the Iterable
element type to some
Comparable
type, produce a sorted List
of the original elements based on sorting applied to the
result of the mapping function. Note that this is both eager and monolithic.- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <A,
B extends Comparable<B>>
SortBy<A, B> sortBy()
static <A,
B extends Comparable<B>>
Fn1<Iterable<A>, List<A>> static <A,
B extends Comparable<B>>
List<A> Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.jnape.palatable.lambda.functions.Fn1
andThen, carry, cartesian, censor, choose, cocartesian, diMap, diMapR, discardL, flatMap, fmap, lazyZip, listens, local, pure, self, thunk, toFunction, trampolineM, zip, zip
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
SortBy
private SortBy()
-
-
Method Details
-
checkedApply
-
sortBy
-
sortBy
public static <A,B extends Comparable<B>> Fn1<Iterable<A>,List<A>> sortBy(Fn1<? super A, ? extends B> fn) -
sortBy
public static <A,B extends Comparable<B>> List<A> sortBy(Fn1<? super A, ? extends B> fn, Iterable<A> as)
-