T - the type of the first argument to the functionU - the type of the second argument to the functionR - the type of the result of the functionE - the type of the potential exception of the functionExceptionHandlerSupport<T,U>, ObjectReturnExceptionHandlerSupport<BiFunction<T,U,R>,BiFunction<T,U,Optional<R>>,BiFunction<T,U,CompletionStage<R>>,R>BinaryOperatorWithException<T,E>@FunctionalInterface public interface BiFunctionWithException<T,U,R,E extends Exception> extends ObjectReturnExceptionHandlerSupport<BiFunction<T,U,R>,BiFunction<T,U,Optional<R>>,BiFunction<T,U,CompletionStage<R>>,R>
FunctionWithException.
R apply(T t, U u) throws
E - The functional method.BiFunction<T,U,R>BiFunction<T,U,<Optional<R>>BiFunction<T,U,R>BiFunction| Modifier and Type | Method | Description |
|---|---|---|
default <V> BiFunctionWithException<T,U,V,E> |
andThen(FunctionWithException<? super R,? extends V,? extends E> after) |
Returns a composed
FunctionWithException that first applies this
FunctionWithException to its input, and then applies the
after FunctionWithException to the result. |
R |
apply(T t,
U u) |
Applies this function to the given arguments.
|
default BiConsumerWithException<T,U,E> |
asBiConsumer() |
Converts a
BiFunctionWithException to a
BiConsumerWithException. |
static <T,U,R,E extends Exception> |
asBiConsumer(BiFunctionWithException<T,U,R,E> function) |
Converts a
BiFunctionWithException to a
BiConsumerWithException. |
static <T,U,R,E extends Exception> |
asFunction(BiFunctionWithException<T,U,R,E> function,
U u) |
Converts a
BiFunctionWithException to a
FunctionWithException. |
default FunctionWithException<T,R,E> |
asFunction(U u) |
Converts a
BiFunctionWithException to a
FunctionWithException. |
static <T,U,R,E extends Exception> |
failing(Supplier<E> exceptionBuilder) |
Returns a
FunctionWithException that always throw exception. |
default BiFunction<T,U,R> |
ignore() |
Converts this
BiFunctionWithException to a lifted BiFunction
returning null in case of exception. |
static <T,U,R,E extends Exception> |
ignored(BiFunctionWithException<T,U,R,E> function) |
Converts a
BiFunctionWithException to a lifted BiFunction
returning null in case of exception. |
default BiFunction<T,U,Optional<R>> |
lift() |
Converts this
BiFunctionWithException to a lifted BiFunction
using Optional as return value. |
static <T,U,R,E extends Exception> |
lifted(BiFunctionWithException<T,U,R,E> function) |
Converts a
BiFunctionWithException to a lifted BiFunction
using Optional as return value. |
default BiFunction<T,U,CompletionStage<R>> |
stage() |
Convert this
BiFunctionWithException to a lifted BiFunction
that uses CompletionStage as return value. |
static <T,U,R,E extends Exception> |
staged(BiFunctionWithException<T,U,R,E> function) |
Convert this
BiFunctionWithException to a lifted BiFunction
return CompletionStage as return value. |
default BiFunction<T,U,R> |
uncheck() |
Converts this
BiFunctionWithException to a BiFunction that
wraps exception to RuntimeException. |
static <T,U,R,E extends Exception> |
unchecked(BiFunctionWithException<T,U,R,E> function) |
Converts a
BiFunctionWithException to a BiFunction that
convert exception to RuntimeException. |
static <T,U,R,E extends Exception> |
unchecked(BiFunctionWithException<T,U,R,E> function,
Function<Exception,RuntimeException> exceptionMapper) |
Converts a
BiFunctionWithException to a BiFunction that
convert exception to RuntimeException by using the provided mapping
function. |
exceptionMapper, exceptionMapperFornotThrowingHandler, staged, throwingHandler, uncheckedR apply(T t, U u) throws E extends Exception
t - the first function argumentu - the second function argumentE - any exceptionE extends ExceptionBiFunction.apply(Object,Object)default BiFunction<T,U,R> uncheck()
BiFunctionWithException to a BiFunction that
wraps exception to RuntimeException.uncheck in interface ExceptionHandlerSupport<T,U>uncheck in interface ObjectReturnExceptionHandlerSupport<T,U,R,E extends Exception>unchecked(BiFunctionWithException),
unchecked(BiFunctionWithException, Function),
BiFunctiondefault BiFunction<T,U,Optional<R>> lift()
BiFunctionWithException to a lifted BiFunction
using Optional as return value.lift in interface ExceptionHandlerSupport<T,U>lift in interface ObjectReturnExceptionHandlerSupport<T,U,R,E extends Exception>lifted(BiFunctionWithException),
BiFunctiondefault BiFunction<T,U,R> ignore()
BiFunctionWithException to a lifted BiFunction
returning null in case of exception.ignore in interface ExceptionHandlerSupport<T,U>ignore in interface ObjectReturnExceptionHandlerSupport<T,U,R,E extends Exception>ignored(BiFunctionWithException),
BiFunctiondefault BiFunction<T,U,CompletionStage<R>> stage()
BiFunctionWithException to a lifted BiFunction
that uses CompletionStage as return value.stage in interface ObjectReturnExceptionHandlerSupport<T,U,R,E extends Exception>staged(BiFunctionWithException),
BiFunction,
CompletionStagedefault <V> BiFunctionWithException<T,U,V,E> andThen(FunctionWithException<? super R,? extends V,? extends E> after)
FunctionWithException that first applies this
FunctionWithException to its input, and then applies the
after FunctionWithException to the result. If evaluation of
either FunctionWithException throws an exception, it is relayed to
the caller of the composed function.V - the type of output of the after
FunctionWithException, and of the composed
FunctionWithExceptionafter - the function to apply after this FunctionWithException is
appliedafter functionNullPointerException - if after is nullBiFunction.andThen(Function)static <T,U,R,E extends Exception> BiFunctionWithException<T,U,R,E> failing(Supplier<E> exceptionBuilder)
FunctionWithException that always throw exception.T - the type of the first argument to the functionU - the type of the second argument to the functionR - the type of the result of the functionE - the type of the exceptionexceptionBuilder - the supplier to create the exceptionstatic <T,U,R,E extends Exception> BiFunction<T,U,R> unchecked(BiFunctionWithException<T,U,R,E> function)
BiFunctionWithException to a BiFunction that
convert exception to RuntimeException.
For example :
BiFunction<String, String, String> biFunctionThrowingRuntimeException = BiFunctionWithException
.unchecked(biFouctionThrowingException);
Will generate a BiFunction throwing RuntimeException in case
of error.T - the type of the first argument to the functionU - the type of the second argument to the functionR - the type of the result of the functionE - the type of the potential exceptionfunction - to be uncheckedNullPointerException - if function is nulluncheck(),
unchecked(BiFunctionWithException, Function)static <T,U,R,E extends Exception> BiFunction<T,U,R> unchecked(BiFunctionWithException<T,U,R,E> function, Function<Exception,RuntimeException> exceptionMapper)
BiFunctionWithException to a BiFunction that
convert exception to RuntimeException by using the provided mapping
function.
For example :
BiFunction<String, String, String> functionThrowingRuntimeException = BiFunctionWithException
.unchecked(fonctionThrowingException, IllegalArgumentException::new);
Will generate a BiFunction throwing IllegalArgumentException
in case of error.T - the type of the first argument to the functionU - the type of the second argument to the functionR - the type of the result of the functionE - the type of the potential exceptionfunction - the be uncheckedexceptionMapper - a function to convert the exception to the runtime exception.NullPointerException - if function or exceptionMapper is nulluncheck(),
unchecked(BiFunctionWithException)static <T,U,R,E extends Exception> BiFunction<T,U,Optional<R>> lifted(BiFunctionWithException<T,U,R,E> function)
BiFunctionWithException to a lifted BiFunction
using Optional as return value.T - the type of the first argument to the functionU - the type of the second argument to the functionR - the type of the result of the functionE - the type of the potential exceptionfunction - to be liftedNullPointerException - if function is nulllift()static <T,U,R,E extends Exception> BiFunction<T,U,R> ignored(BiFunctionWithException<T,U,R,E> function)
BiFunctionWithException to a lifted BiFunction
returning null in case of exception.T - the type of the first argument to the functionU - the type of the second argument to the functionR - the type of the result of the functionE - the type of the potential exceptionfunction - to be liftedNullPointerException - if function is nullignore()static <T,U,R,E extends Exception> BiFunction<T,U,CompletionStage<R>> staged(BiFunctionWithException<T,U,R,E> function)
BiFunctionWithException to a lifted BiFunction
return CompletionStage as return value.T - the type of the first argument to the functionU - the type of the second argument to the functionR - the type of the result of the functionE - the type of the potential exceptionfunction - to be liftedNullPointerException - if function is nullstage()static <T,U,R,E extends Exception> BiConsumerWithException<T,U,E> asBiConsumer(BiFunctionWithException<T,U,R,E> function)
BiFunctionWithException to a
BiConsumerWithException.T - the type of the first argument to the operationU - the type of the second argument to the operationR - the type of the return value of the functionE - the type of the potential exception of the operationfunction - to be converterNullPointerException - if function is nulldefault BiConsumerWithException<T,U,E> asBiConsumer()
BiFunctionWithException to a
BiConsumerWithException.static <T,U,R,E extends Exception> FunctionWithException<T,R,E> asFunction(BiFunctionWithException<T,U,R,E> function, U u)
BiFunctionWithException to a
FunctionWithException.T - the type of the first argument to the operationU - the type of the second argument to the operationR - the type of the return value of the functionE - the type of the potential exception of the operationfunction - to be converteru - the second parameter of the BiFunctionWithException that
will be used inside the new {code FunctionWithException}.NullPointerException - if function is nulldefault FunctionWithException<T,R,E> asFunction(U u)
BiFunctionWithException to a
FunctionWithException.u - the second parameter of the BiFunctionWithException that
will be used inside the new {code FunctionWithException}.Copyright © 2019. All rights reserved.