Package io.vavr.control
Interface CheckedFunction<T,R>
-
- Type Parameters:
T
- the type of this function's domainR
- the type of this function's codomain, i.e. the return type
- 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 CheckedFunction<T,R>
A Function which may throw.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default <U> CheckedFunction<T,U>
andThen(CheckedFunction<? super R,? extends U> after)
Returns a composed function that first applies this to the given argument and then appliesafter
to the result.R
apply(T t)
Applies this function to one argument and returns the result.default <U> CheckedFunction<U,R>
compose(CheckedFunction<? super U,? extends T> before)
Returns a composed function that first appliesbefore
to the given argument and then applies this to the result.static <T> CheckedFunction<T,T>
identity()
Returns the identityCheckedFunction
, i.e.
-
-
-
Method Detail
-
identity
static <T> CheckedFunction<T,T> identity()
Returns the identityCheckedFunction
, i.e. the function that returns its input.- Type Parameters:
T
- argument type (and return type) of the identity function- Returns:
- the identity
CheckedFunction
-
apply
R apply(T t) throws java.lang.Exception
Applies this function to one argument and returns the result.- Parameters:
t
- argument of typeT
- Returns:
- the result of the function application
- Throws:
java.lang.Exception
- if something goes wrong applying this function to the given argument
-
andThen
default <U> CheckedFunction<T,U> andThen(CheckedFunction<? super R,? extends U> after)
Returns a composed function that first applies this to the given argument and then appliesafter
to the result.- Type Parameters:
U
- return type of after- Parameters:
after
- the function applied after this- Returns:
- a function composed of this and
after
- Throws:
java.lang.NullPointerException
- ifafter
is null
-
compose
default <U> CheckedFunction<U,R> compose(CheckedFunction<? super U,? extends T> before)
Returns a composed function that first appliesbefore
to the given argument and then applies this to the result.- Type Parameters:
U
- argument type of before- Parameters:
before
- the function applied before this- Returns:
- a function composed of
before
and this - Throws:
java.lang.NullPointerException
- ifbefore
is null
-
-