Package de.xima.fc.interfaces
Interface IThrowingBiFunction<T,U,R>
-
- Type Parameters:
T
- the type of the input to the functionU
- the type of the input to the functionR
- the type of the result of the function
- All Superinterfaces:
BiFunction<T,U,R>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface IThrowingBiFunction<T,U,R> extends BiFunction<T,U,R>
ABiFunction
that may throw a checked exception.Represents a function that accepts two arguments and produces a result.
This is a
functional interface
whose functional method isapply(Object, Object)
.- Since:
- 8.0.1
- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default R
apply(T t, U u)
static <T,U,R>
IThrowingBiFunction<T,U,R>of(IThrowingBiFunction<T,U,R> fn)
Returns the given bi-function, for improved variable inference.static <T,U,R>
IThrowingBiFunction<T,U,R>throwingBiFunction(IThrowingBiFunction<T,U,R> fn)
Returns the given bi-function, for improved variable inference.R
tryApply(T t, U u)
Gets a result.-
Methods inherited from interface java.util.function.BiFunction
andThen
-
-
-
-
Method Detail
-
tryApply
R tryApply(T t, U u) throws Exception
Gets a result.- Parameters:
t
- the first function argumentu
- the second function argument- Returns:
- the function result
- Throws:
Exception
- When this operation fails.
-
of
static <T,U,R> IThrowingBiFunction<T,U,R> of(IThrowingBiFunction<T,U,R> fn)
Returns the given bi-function, for improved variable inference. Sometimes you need to create local variables and assign them to a new lambda. This does not work well with variable inference, as Java cannot infer the type of an anonymous lambda. This utility method lets you write slightly more readable code like this:final var fn = IThrowingBiFunction.of(t -> ...);
- Type Parameters:
T
- the type of the input to the functionU
- the type of the input to the functionR
- the type of the result of the function- Parameters:
fn
- Bi-function to return.- Returns:
- The given bi-function.
-
throwingBiFunction
static <T,U,R> IThrowingBiFunction<T,U,R> throwingBiFunction(IThrowingBiFunction<T,U,R> fn)
Returns the given bi-function, for improved variable inference. Sometimes you need to create local variables and assign them to a new lambda. This does not work well with variable inference, as Java cannot infer the type of an anonymous lambda. This utility method lets you write slightly more readable code like this:final var fn = IThrowingBiFunction.of(t -> ...);
- Type Parameters:
T
- the type of the input to the functionU
- the type of the input to the functionR
- the type of the result of the function- Parameters:
fn
- Bi-function to return.- Returns:
- The given bi-function.
-
-