Package de.xima.fc.interfaces
Interface IThrowingUnaryOperator<T>
-
- Type Parameters:
T
- the type of the input to the function and output of the function.
- All Superinterfaces:
Function<T,T>
,IThrowingFunction<T,T>
,UnaryOperator<T>
- 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 IThrowingUnaryOperator<T> extends IThrowingFunction<T,T>, UnaryOperator<T>
AUnaryOperator
that may throw a checked exception.Represents a function that accepts one argument and produces a result of the same type.
This is a
functional interface
whose functional method isIThrowingFunction.apply(Object)
.- Since:
- 8.2.0
- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
Static Methods Modifier and Type Method Description static <T> IThrowingUnaryOperator<T>
identity()
Returns a throwing unary operator that always returns its input argument.static <T> IThrowingUnaryOperator<T>
of(IThrowingUnaryOperator<T> operator)
Returns the given operator, for improved variable inference.static <T> IThrowingUnaryOperator<T>
throwingUnaryOperator(IThrowingUnaryOperator<T> operator)
Returns the given operator, for improved variable inference.-
Methods inherited from interface de.xima.fc.interfaces.IThrowingFunction
apply, tryApply
-
-
-
-
Method Detail
-
of
static <T> IThrowingUnaryOperator<T> of(IThrowingUnaryOperator<T> operator)
Returns the given operator, 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 = IThrowingUnaryOperator.of(t -> ...);
- Type Parameters:
T
- The type of the input and output of the operator.- Parameters:
operator
- Operator to return.- Returns:
- The given operator.
-
throwingUnaryOperator
static <T> IThrowingUnaryOperator<T> throwingUnaryOperator(IThrowingUnaryOperator<T> operator)
Returns the given operator, 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 = throwingUnaryOperator(t -> ...);
- Type Parameters:
T
- The type of the input and output of the operator.- Parameters:
operator
- Operator to return.- Returns:
- The given operator.
-
identity
static <T> IThrowingUnaryOperator<T> identity()
Returns a throwing unary operator that always returns its input argument.- Type Parameters:
T
- The type of the input and output of the operator.- Returns:
- A throwing unary operator that always returns its input argument.
-
-