Class MaxBy<A, B extends Comparable<B>>
java.lang.Object
com.jnape.palatable.lambda.semigroup.builtin.MaxBy<A,B>
- Type Parameters:
A- the value typeB- the mapped comparison type
- All Implemented Interfaces:
Fn1<Fn1<? super A, ? extends B>, Fn1<A,Fn1<A, A>>>, Fn2<Fn1<? super A, ? extends B>, A, Fn1<A, A>>, Fn3<Fn1<? super A, ? extends B>, A, A, A>, SemigroupFactory<Fn1<? super A, ? extends B>, A>, Applicative<Fn1<A, Fn1<A, A>>, Fn1<Fn1<? super A, ? extends B>, ?>>, Cartesian<Fn1<? super A, ? extends B>, Fn1<A, Fn1<A, A>>, Fn1<?, ?>>, Cocartesian<Fn1<? super A, ? extends B>, Fn1<A, Fn1<A, A>>, Fn1<?, ?>>, Contravariant<Fn1<? super A, ? extends B>, Profunctor<?, Fn1<A, Fn1<A, A>>, Fn1<?, ?>>>, Functor<Fn1<A, Fn1<A, A>>, Fn1<Fn1<? super A, ? extends B>, ?>>, Profunctor<Fn1<? super A, ? extends B>, Fn1<A, Fn1<A, A>>, Fn1<?, ?>>, Monad<Fn1<A, Fn1<A, A>>, Fn1<Fn1<? super A, ? extends B>, ?>>, MonadReader<Fn1<? super A, ? extends B>, Fn1<A, Fn1<A, A>>, Fn1<Fn1<? super A, ? extends B>, ?>>, MonadRec<Fn1<A, Fn1<A, A>>, Fn1<Fn1<? super A, ? extends B>, ?>>, MonadWriter<Fn1<? super A, ? extends B>, Fn1<A, Fn1<A, A>>, Fn1<Fn1<? super A, ? extends B>, ?>>
public final class MaxBy<A, B extends Comparable<B>>
extends Object
implements SemigroupFactory<Fn1<? super A, ? extends B>, A>
Given a mapping function from some type
A to some Comparable type B, produce a
Semigroup over A that chooses between two values x and y via the
following rules:
- If
xis strictly less thanyin terms ofB, returny - Otherwise, return
x
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncheckedApply(Fn1<? super A, ? extends B> compareFn) Invoke this function with the given argument, potentially throwing anyThrowable.static <A, B extends Comparable<B>>
MaxBy<A, B> maxBy()static <A, B extends Comparable<B>>
Semigroup<A> static <A, B extends Comparable<B>>
Fn1<A, A> static <A, B extends Comparable<B>>
AMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Fn1
andThen, carry, cartesian, censor, choose, cocartesian, diMap, diMapR, discardL, flatMap, fmap, lazyZip, listens, local, pure, self, thunk, toFunction, trampolineM, zip, zipMethods inherited from interface Fn2
toBiFunctionMethods inherited from interface Fn3
apply, apply, checkedApply, compose, contraMap, diMapL, discardR, flip, uncurry, widenMethods inherited from interface SemigroupFactory
apply, checkedApply
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
MaxBy
private MaxBy()
-
-
Method Details
-
checkedApply
Description copied from interface:Fn2Invoke this function with the given argument, potentially throwing anyThrowable.- Specified by:
checkedApplyin interfaceFn1<A, B extends Comparable<B>>- Specified by:
checkedApplyin interfaceFn2<Fn1<? super A, ? extends B extends Comparable<B>>, A, Fn1<A,A>> - Specified by:
checkedApplyin interfaceSemigroupFactory<A, B extends Comparable<B>>- Parameters:
compareFn- the argument- Returns:
- the result of the function application
-
maxBy
-
maxBy
public static <A, B extends Comparable<B>> Semigroup<A> maxBy(Fn1<? super A, ? extends B> compareFn) -
maxBy
public static <A, B extends Comparable<B>> Fn1<A,A> maxBy(Fn1<? super A, ? extends B> compareFn, A x) -
maxBy
-