@FunctionalInterface public interface LFunction<T,R> extends java.util.function.Function<T,R>, MetaFunction, MetaInterface.NonThrowing, OFunction<T,aType.a<R>>, Codomain<aType.a<R>>, Domain1<aType.a<T>>
Non-throwing functional interface (lambda) LFunction for Java 8.
Type: function
Domain (lvl: 1): T a
Co-domain: R
Special case of function that corresponds to expressions like (iterator) -> Iterator::next
| Modifier and Type | Interface and Description |
|---|---|
static class |
LFunction.LFunctionSingle<T,R> |
MetaInterface.NonThrowing, MetaInterface.Throwing<X>| Modifier and Type | Field and Description |
|---|---|
static String |
DESCRIPTION |
static LSupplier<String> |
NULL_VALUE_MESSAGE_SUPPLIER |
| Modifier and Type | Method and Description |
|---|---|
default LFunction<T,R> |
after(LConsumer<? super R> after) |
default R |
apply(T a) |
default R |
apply(T a,
ExWF<RuntimeException> exF) |
default R |
apply(T a,
ExWMF<RuntimeException> exF,
String newMessage,
Object... messageParams) |
default R |
applyThen(T a,
LFunction<Throwable,R> handler) |
R |
applyX(T a)
Implement this, but call apply(T a)
|
default LFunction<T,R> |
before(LConsumer<? super T> before) |
static <T,R> R |
call(T a,
LFunction<T,R> lambda) |
default LSupplier<R> |
capture(T a)
Captures arguments but delays the evaluation.
|
default <V2,V3> LFunction<V2,V3> |
cast()
Cast that replace generics.
|
static <V2,V3,T,R> |
cast(LFunction<T,R> function)
Cast that replace generics.
|
default <V> LFunction<V,R> |
compose(LFunction<? super V,? extends T> before)
Allows to manipulate the domain of the function.
|
static <V,T,R> LFunction<V,R> |
composed(LFunction<? super V,? extends T> before,
LFunction<T,R> after) |
static <T,R> LFunction<T,R> |
constant(R r)
Creates function that always returns the same value.
|
static <T,R> LFunction<T,R> |
failSafe(LFunction<T,R> func,
LFunction<T,R> failSafe) |
default R |
failSafeApply(T a,
LFunction<T,R> failSafe) |
static <T,R> R |
failSafeApply(T a,
LFunction<T,R> func,
LFunction<T,R> failSafe) |
default <C0> void |
forEach(IndexedRead<C0,aType.a<T>> ia,
C0 source,
LConsumer<? super R> consumer)
For each element (or tuple) from arguments, calls the function and passes the result to consumer.
|
static <T,R> void |
fromTill(int min_i,
int max_i,
T a,
LFunction<T,R> func)
From-To.
|
static <T,R> void |
fromTo(int min_i,
int max_i,
T a,
LFunction<T,R> func)
From-To.
|
static <T,R> LFunction<T,R> |
func(LFunction<T,R> lambda)
Convenient method in case lambda expression is ambiguous for the compiler (that might happen for overloaded methods accepting different interfaces).
|
static <T,R> LFunction<T,R> |
funcThrowing(ExF<Throwable> exF) |
static <T,R> LFunction<T,R> |
funcThrowing(String message,
ExMF<Throwable> exF) |
default String |
functionalInterfaceDescription()
Returns description of the functional interface.
|
default LFunction<T,R> |
handling(HandlingInstructions<Throwable,RuntimeException> handling) |
default R |
handlingApply(T a,
HandlingInstructions<Throwable,RuntimeException> handling)
Function call that handles exceptions according to the instructions.
|
static <T,R> R |
handlingApply(T a,
LFunction<T,R> func,
HandlingInstructions<Throwable,RuntimeException> handling) |
static <V> LFunction<V,V> |
identity()
Returns a function that always returns its input argument.
|
default <C0,I0> void |
iterate(SequentialRead<C0,I0,aType.a<T>> sa,
C0 source,
LConsumer<? super R> consumer)
For each element (or tuple) from arguments, calls the function and passes the result to consumer.
|
default R |
nestingApply(T a)
Function call that handles exceptions by always nesting checked exceptions and propagating the others as is.
|
default LFunction<T,R> |
nonNullable()
Converts to function that makes sure that the result is not null.
|
default R |
nonNullApply(T a)
Function call that ensures the result is not null
|
static <T,R> R |
produce(T a)
Does nothing (LFunction) Function
|
static <T,R> LFunction<T,R> |
recursive(LFunction<LFunction<T,R>,LFunction<T,R>> selfLambda) |
static <T,R> LFunction<T,R> |
safe()
Safe instance.
|
static <T,R> LFunction<T,R> |
safe(LFunction<T,R> other)
Safe wrapping.
|
static <T,R> LSupplier<LFunction<T,R>> |
safeSupplier()
Safe instance supplier.
|
static <T,R> LSupplier<LFunction<T,R>> |
safeSupplier(LSupplier<LFunction<T,R>> supplier)
Safe supplier.
|
default R |
shovingApply(T a)
Function call that handles exceptions by always propagating them as is, even when they are undeclared checked ones.
|
default <V> LFunction<T,V> |
then(LFunction<? super R,? extends V> after)
Combines two functions together in a order.
|
default LConsumer<T> |
thenConsume(LConsumer<? super R> after)
Combines two functions together in a order.
|
default LPredicate<T> |
thenToBool(LPredicate<? super R> after)
Combines two functions together in a order.
|
default LToByteFunction<T> |
thenToByte(LToByteFunction<? super R> after)
Combines two functions together in a order.
|
default LToCharFunction<T> |
thenToChar(LToCharFunction<? super R> after)
Combines two functions together in a order.
|
default LToDblFunction<T> |
thenToDbl(LToDblFunction<? super R> after)
Combines two functions together in a order.
|
default LToFltFunction<T> |
thenToFlt(LToFltFunction<? super R> after)
Combines two functions together in a order.
|
default LToIntFunction<T> |
thenToInt(LToIntFunction<? super R> after)
Combines two functions together in a order.
|
default LToLongFunction<T> |
thenToLong(LToLongFunction<? super R> after)
Combines two functions together in a order.
|
default LToSrtFunction<T> |
thenToSrt(LToSrtFunction<? super R> after)
Combines two functions together in a order.
|
static <T,R> void |
times(int max_i,
T a,
LFunction<T,R> func)
From-To.
|
static <T,R> R |
tryApply(T a,
LFunction<T,R> func) |
static <T,R> R |
tryApply(T a,
LFunction<T,R> func,
ExWF<RuntimeException> exF) |
static <T,R> R |
tryApply(T a,
LFunction<T,R> func,
ExWMF<RuntimeException> exF,
String newMessage,
Object... messageParams) |
static <T,R> R |
tryApplyThen(T a,
LFunction<T,R> func,
LFunction<Throwable,R> handler) |
default LFunction<T,R> |
trying(ExWF<RuntimeException> exF) |
default LFunction<T,R> |
trying(ExWMF<RuntimeException> exF,
String newMessage,
Object... messageParams) |
default LFunction<T,R> |
tryingThen(LFunction<Throwable,R> handler) |
default R |
tupleApply(LSingle<T> args) |
default LFunction |
untyped()
Cast that removes generics.
|
static <T,R> LFunction<T,R> |
wrap(java.util.function.Function<T,R> other)
Wraps JRE instance.
|
andThen, composeisThrowingisFunctionformatTo, isAction, isConsumer, isOperator, isPredicate, isSupplierstatic final String DESCRIPTION
@Nullable default R apply(T a)
apply in interface java.util.function.Function<T,R>default R handlingApply(T a, HandlingInstructions<Throwable,RuntimeException> handling)
Function call that handles exceptions according to the instructions.
default LFunction<T,R> handling(HandlingInstructions<Throwable,RuntimeException> handling)
default R apply(T a, @Nonnull ExWMF<RuntimeException> exF, @Nonnull String newMessage, @Nullable Object... messageParams)
default LFunction<T,R> trying(@Nonnull ExWMF<RuntimeException> exF, @Nonnull String newMessage, @Nullable Object... messageParams)
default R apply(T a, @Nonnull ExWF<RuntimeException> exF)
default R nestingApply(T a)
Function call that handles exceptions by always nesting checked exceptions and propagating the others as is.
default R shovingApply(T a)
Function call that handles exceptions by always propagating them as is, even when they are undeclared checked ones.
static <T,R> R handlingApply(T a,
LFunction<T,R> func,
HandlingInstructions<Throwable,RuntimeException> handling)
static <T,R> R tryApply(T a,
LFunction<T,R> func)
static <T,R> R tryApply(T a,
LFunction<T,R> func,
@Nonnull
ExWMF<RuntimeException> exF,
@Nonnull
String newMessage,
@Nullable
Object... messageParams)
static <T,R> R tryApply(T a,
LFunction<T,R> func,
@Nonnull
ExWF<RuntimeException> exF)
static <T,R> R tryApplyThen(T a,
LFunction<T,R> func,
@Nonnull
LFunction<Throwable,R> handler)
static <T,R> R failSafeApply(T a,
LFunction<T,R> func,
@Nonnull
LFunction<T,R> failSafe)
static <T,R> LFunction<T,R> failSafe(LFunction<T,R> func, @Nonnull LFunction<T,R> failSafe)
@Nonnull default String functionalInterfaceDescription()
Returns description of the functional interface.
functionalInterfaceDescription in interface MetaFunctionalInterfacestatic <T,R> void fromTo(int min_i,
int max_i,
T a,
LFunction<T,R> func)
From-To. Intended to be used with non-capturing lambda.
static <T,R> void fromTill(int min_i,
int max_i,
T a,
LFunction<T,R> func)
From-To. Intended to be used with non-capturing lambda.
static <T,R> void times(int max_i,
T a,
LFunction<T,R> func)
From-To. Intended to be used with non-capturing lambda.
default LFunction untyped()
Cast that removes generics.
default <V2,V3> LFunction<V2,V3> cast()
Cast that replace generics.
static <T,R> LFunction<T,R> constant(R r)
Creates function that always returns the same value.
@Nonnull static <T,R> LFunction<T,R> func(@Nonnull LFunction<T,R> lambda)
Convenient method in case lambda expression is ambiguous for the compiler (that might happen for overloaded methods accepting different interfaces).
@Nonnull static <T,R> LFunction<T,R> recursive(@Nonnull LFunction<LFunction<T,R>,LFunction<T,R>> selfLambda)
@Nonnull static <T,R> LFunction<T,R> funcThrowing(String message, @Nonnull ExMF<Throwable> exF)
@Nonnull static <T,R> LFunction<T,R> wrap(java.util.function.Function<T,R> other)
Wraps JRE instance.
@Nonnull static <T,R> LFunction<T,R> safe()
Safe instance. That always returns the same value (as produce).
@Nonnull static <T,R> LSupplier<LFunction<T,R>> safeSupplier()
Safe instance supplier. Returns supplier of safe() instance.
@Nonnull static <T,R> LFunction<T,R> safe(@Nullable LFunction<T,R> other)
Safe wrapping. Either argument function is returned (if it is not null) or safe() instance.
@Nonnull static <T,R> LSupplier<LFunction<T,R>> safeSupplier(@Nullable LSupplier<LFunction<T,R>> supplier)
Safe supplier. Either argument supplier is returned (if it is not null) or supplier of safe() instance.
@Nonnull default <V> LFunction<V,R> compose(@Nonnull LFunction<? super V,? extends T> before)
Allows to manipulate the domain of the function.
static <V,T,R> LFunction<V,R> composed(@Nonnull LFunction<? super V,? extends T> before, LFunction<T,R> after)
@Nonnull default <V> LFunction<T,V> then(@Nonnull LFunction<? super R,? extends V> after)
Combines two functions together in a order.
@Nonnull default LConsumer<T> thenConsume(@Nonnull LConsumer<? super R> after)
Combines two functions together in a order.
@Nonnull default LToByteFunction<T> thenToByte(@Nonnull LToByteFunction<? super R> after)
Combines two functions together in a order.
@Nonnull default LToSrtFunction<T> thenToSrt(@Nonnull LToSrtFunction<? super R> after)
Combines two functions together in a order.
@Nonnull default LToIntFunction<T> thenToInt(@Nonnull LToIntFunction<? super R> after)
Combines two functions together in a order.
@Nonnull default LToLongFunction<T> thenToLong(@Nonnull LToLongFunction<? super R> after)
Combines two functions together in a order.
@Nonnull default LToFltFunction<T> thenToFlt(@Nonnull LToFltFunction<? super R> after)
Combines two functions together in a order.
@Nonnull default LToDblFunction<T> thenToDbl(@Nonnull LToDblFunction<? super R> after)
Combines two functions together in a order.
@Nonnull default LToCharFunction<T> thenToChar(@Nonnull LToCharFunction<? super R> after)
Combines two functions together in a order.
@Nonnull default LPredicate<T> thenToBool(@Nonnull LPredicate<? super R> after)
Combines two functions together in a order.
@Nonnull static <V> LFunction<V,V> identity()
Returns a function that always returns its input argument.
identity in interface java.util.function.Function<T,R>@Nonnull default LFunction<T,R> nonNullable()
Converts to function that makes sure that the result is not null.
static <T,R> R produce(T a)
Does nothing (LFunction) Function
default <C0> void forEach(IndexedRead<C0,aType.a<T>> ia, C0 source, LConsumer<? super R> consumer)
For each element (or tuple) from arguments, calls the function and passes the result to consumer. Thread safety, fail-fast, fail-safety of this method is not expected.
default <C0,I0> void iterate(SequentialRead<C0,I0,aType.a<T>> sa, C0 source, LConsumer<? super R> consumer)
For each element (or tuple) from arguments, calls the function and passes the result to consumer. Thread safety, fail-fast, fail-safety of this method depends highly on the arguments.
Copyright © 2019. All rights reserved.