Package pro.horde.os.cutils.function
Interface ThrowingUnaryOperation<T>
-
- Type Parameters:
T- the type of the input to the function
- All Superinterfaces:
ThrowingFunction<T,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 ThrowingUnaryOperation<T> extends ThrowingFunction<T,T>
Represents an operation on a single operand that produces a result of the same type as its operand. This is a specialization ofFunctionfor the case where the operand and result are of the same type.When you find yourself in a situation where you need to use a function ( that throws an exception), this class is what you need to achieve your goal without Java complaining.
The class Represents a function that accepts one argument and produces a result. whose functional method is
ThrowingFunction.apply(Object).- Since:
- 5.0
- Author:
- Bobai Kato
- See Also:
ThrowingFunction,UnaryOperator
-
-
Method Summary
Static Methods Modifier and Type Method Description static <T> UnaryOperator<T>identity()Returns a unary operator that always returns its input argument.static <T extends Exception,R>
RsneakyThrow(Exception ex)Sneak exception on function execution.static <T> UnaryOperator<T>unchecked(ThrowingUnaryOperation<T> operator)Uncheck method which will take operation that will throw Exception.-
Methods inherited from interface pro.horde.os.cutils.function.ThrowingFunction
apply
-
-
-
-
Method Detail
-
identity
static <T> UnaryOperator<T> identity()
Returns a unary operator that always returns its input argument.- Type Parameters:
T- the type of the input and output of the operator- Returns:
- a unary operator that always returns its input argument
-
sneakyThrow
static <T extends Exception,R> R sneakyThrow(Exception ex) throws T extends Exception
Sneak exception on function execution.- Type Parameters:
T- arg typeR- return type- Parameters:
ex- exception throw on operation- Returns:
- an exception
- Throws:
T- arg type exceptionT extends Exception
-
unchecked
static <T> UnaryOperator<T> unchecked(ThrowingUnaryOperation<T> operator)
Uncheck method which will take operation that will throw Exception.- Type Parameters:
T- the type of the input to the function- Parameters:
operator- Variable ofThrowingFunction- Returns:
- A
Function
-
-