Package org.osgi.util.function
Interface Function<T,R> 
- Type Parameters:
- T- The type of the function input.
- R- The type of the function output.
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A function that accepts a single argument and produces a result.
 
This is a functional interface and can be used as the assignment target for a lambda expression or method reference.
- "ThreadSafe"
- 
Method SummaryModifier and TypeMethodDescriptionCompose the specifiedFunctionto be called on the value returned by thisFunction.Applies this function to the specified argument.static <T,R> Function<T, R> asFunction(Function<T, R> wrapped) Returns aFunctionwhich wraps the specifiedjava.util.function.Function.static <T,R> Function<T, R> asJavaFunction(Function<T, R> wrapped) Returns ajava.util.function.Functionwhich wraps the specifiedFunctionand throws any thrown exceptions.static <T,R> Function<T, R> asJavaFunctionOrElse(Function<T, R> wrapped, R orElse) Returns ajava.util.function.Functionwhich wraps the specifiedFunctionand the specified value.static <T,R> Function<T, R> asJavaFunctionOrElseGet(Function<T, R> wrapped, Supplier<? extends R> orElseGet) Returns ajava.util.function.Functionwhich wraps the specifiedFunctionand the specifiedjava.util.function.Supplier.Compose the specifiedFunctionto be called to supply a value to be consumed by thisFunction.
- 
Method Details- 
applyApplies this function to the specified argument.- Parameters:
- t- The input to this function.
- Returns:
- The output of this function.
- Throws:
- Exception- An exception thrown by the method.
 
- 
andThenCompose the specifiedFunctionto be called on the value returned by thisFunction.- Type Parameters:
- S- The type of the value supplied by the specified- Function.
- Parameters:
- after- The- Functionto be called on the value returned by this- Function. Must not be- null.
- Returns:
- A Functioncomposed of thisFunctionand the specifiedFunction.
 
- 
composeCompose the specifiedFunctionto be called to supply a value to be consumed by thisFunction.- Type Parameters:
- S- The type of the value consumed the specified- Function.
- Parameters:
- before- The- Functionto be called to supply a value to be consumed by this- Function. Must not be- null.
- Returns:
- A Functioncomposed of thisFunctionand the specifiedFunction.
 
- 
asJavaFunctionReturns ajava.util.function.Functionwhich wraps the specifiedFunctionand throws any thrown exceptions.The returned java.util.function.Functionwill throw any exception thrown by the wrappedFunction.- Type Parameters:
- T- The type of the function input.
- R- The type of the function output.
- Parameters:
- wrapped- The- Functionto wrap. Must not be- null.
- Returns:
- A java.util.function.Functionwhich wraps the specifiedFunction.
 
- 
asJavaFunctionOrElseReturns ajava.util.function.Functionwhich wraps the specifiedFunctionand the specified value.If the the specified Functionthrows anException, the the specified value is returned.- Type Parameters:
- T- The type of the function input.
- R- The type of the function output.
- Parameters:
- wrapped- The- Functionto wrap. Must not be- null.
- orElse- The value to return if the specified- Functionthrows an- Exception.
- Returns:
- A java.util.function.Functionwhich wraps the specifiedFunctionand the specified value.
 
- 
asJavaFunctionOrElseGetstatic <T,R> Function<T,R> asJavaFunctionOrElseGet(Function<T, R> wrapped, Supplier<? extends R> orElseGet) Returns ajava.util.function.Functionwhich wraps the specifiedFunctionand the specifiedjava.util.function.Supplier.If the the specified Functionthrows anException, the value returned by the specifiedjava.util.function.Supplieris returned.- Type Parameters:
- T- The type of the function input.
- R- The type of the function output.
- Parameters:
- wrapped- The- Functionto wrap. Must not be- null.
- orElseGet- The- java.util.function.Supplierto call for a return value if the specified- Functionthrows an- Exception.
- Returns:
- A java.util.function.Functionwhich wraps the specifiedFunctionand the specifiedjava.util.function.Supplier.
 
- 
asFunctionReturns aFunctionwhich wraps the specifiedjava.util.function.Function.- Type Parameters:
- T- The type of the function input.
- R- The type of the function output.
- Parameters:
- wrapped- The- java.util.function.Functionto wrap. Must not be- null.
- Returns:
- A Functionwhich wraps the specifiedjava.util.function.Function.
 
 
-