Package org.wildfly.clustering.function
Interface Function<T,R>
- Type Parameters:
T- the function parameter typeR- the function return type
- All Superinterfaces:
Function<T,R>
- All Known Subinterfaces:
UnaryOperator<T>
- All Known Implementing Classes:
Function.IdentityFunction,UnaryOperator.IdentityOperator
An enhanced function.
- Author:
- Paul Ferraro
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends R,R>
Function<T, R> identity()Returns a function that returns its parameter.static <T,R> Function <T, R> Returns a function that returns the value returned by the specified supplier, ignoring its parameter.static <T,R> Function <T, R> of(R result) Returns a function that always returns the specified value, ignoring its parameter.Returns a function that applies this function if its parameter matches the specified predicate, or returns the value provided by the specified supplier otherwise.withDefault(Predicate<T> predicate, Supplier<T> defaultValue) Returns a function that applies this function to the value returned by the specified provider if its value does not match the specified predicate.
-
Field Details
-
IDENTITY
-
NULL
-
-
Method Details
-
compose
-
andThen
-
withDefault
Returns a function that applies this function to the value returned by the specified provider if its value does not match the specified predicate.- Parameters:
predicate- a predicate used to determine the parameter of this functiondefaultValue- a provider of the default parameter value- Returns:
- a function that applies this function to the value returned by the specified provider if its value does not match the specified predicate.
-
orDefault
Returns a function that applies this function if its parameter matches the specified predicate, or returns the value provided by the specified supplier otherwise.- Parameters:
predicate- a predicate used to determine the parameter of this functiondefaultResult- a provider of the default parameter value- Returns:
- a function that applies this function if its parameter matches the specified predicate, or returns the value provided by the specified supplier otherwise.
-
identity
Returns a function that returns its parameter.- Type Parameters:
T- the function parameter typeR- the function return type- Returns:
- an identity function
-
of
Returns a function that always returns the specified value, ignoring its parameter.- Type Parameters:
T- the function parameter typeR- the function return type- Parameters:
result- the function result- Returns:
- a function that always returns the specified value, ignoring its parameter.
-
of
Returns a function that returns the value returned by the specified supplier, ignoring its parameter.- Type Parameters:
T- the function parameter typeR- the function return type- Parameters:
supplier- the function result supplier- Returns:
- a function that returns the value returned by the specified supplier, ignoring its parameter.
-