Package de.xima.fc.interfaces
Interface ISerializableThrowingFunction<T,R>
-
- Type Parameters:
T
- the type of the input to the functionR
- the type of the result of the function
- All Superinterfaces:
Function<T,R>
,IThrowingFunction<T,R>
,ITypedThrowingFunction<T,R,Exception>
,Serializable
- 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 ISerializableThrowingFunction<T,R> extends IThrowingFunction<T,R>, Serializable
ASupplier
that is also serializable and can throw exceptions.Represents a function that accepts one argument and produces a result.
This is a
functional interface
whose functional method isIThrowingFunction.tryApply(Object)
.- Since:
- 8.0.1
- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
Static Methods Modifier and Type Method Description static <T,R>
ISerializableThrowingFunction<T,R>of(ISerializableThrowingFunction<T,R> fn)
Returns the given function, for improved variable inference.-
Methods inherited from interface de.xima.fc.interfaces.IThrowingFunction
apply, tryApply
-
-
-
-
Method Detail
-
of
static <T,R> ISerializableThrowingFunction<T,R> of(ISerializableThrowingFunction<T,R> fn)
Returns the given 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 = ISerializableThrowingFunction.of(t -> ...);
- Type Parameters:
T
- the type of results supplied by this supplierR
- the type of the result of the function- Parameters:
fn
- Function to return.- Returns:
- The given function.
-
-