Top Description Methods
org.osgi.util.function

public Interface Function<T, R>

Annotations
@ConsumerType
@FunctionalInterface
Type Parameters
<T>
The type of the function input.
<R>
The type of the function output.
Static Imports
java.util.Objects.requireNonNull

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.

Author
$Id: 76cca81359620e401c5eaaeba61491a8671089a6 $

Method Summary

Modifier and TypeMethod and Description
public default <
The type of the value supplied by the specified Function.
S
>
Function<T, S>

Returns:

A Function composed of this Function and the specified Function.
andThen
(Function<? super R, ? extends S>
The Function to be called on the value returned by this Function. Must not be null.
after
)

Compose the specified Function to be called on the value returned by this Function.

public R

Returns:

The output of this function.
apply
(T
The input to this function.
t
)

Applies this function to the specified argument.

public static <
The type of the function input.
T
,
The type of the function output.
R
>
Function<T, R>

Returns:

A Function which wraps the specified java.util.function.Function.
asFunction
(Function<T, R>
The java.util.function.Function to wrap. Must not be null.
wrapped
)

Returns a Function which wraps the specified java.util.function.Function.

public static <
The type of the function input.
T
,
The type of the function output.
R
>
Function<T, R>

Returns:

A java.util.function.Function which wraps the specified Function.
asJavaFunction
(Function<T, R>
The Function to wrap. Must not be null.
wrapped
)

Returns a java.util.function.Function which wraps the specified Function and throws any thrown exceptions.

public static <
The type of the function input.
T
,
The type of the function output.
R
>
Function<T, R>

Returns:

A java.util.function.Function which wraps the specified Function and the specified value.
asJavaFunctionOrElse
(Function<T, R>
The Function to wrap. Must not be null.
wrapped
,
R
The value to return if the specified Function throws an Exception.
orElse
)

Returns a java.util.function.Function which wraps the specified Function and the specified value.

public static <
The type of the function input.
T
,
The type of the function output.
R
>
Function<T, R>

Returns:

A java.util.function.Function which wraps the specified Function and the specified java.util.function.Supplier.
asJavaFunctionOrElseGet
(Function<T, R>
The Function to wrap. Must not be null.
wrapped
,
Supplier<? extends R>
The java.util.function.Supplier to call for a return value if the specified Function throws an Exception.
orElseGet
)

Returns a java.util.function.Function which wraps the specified Function and the specified java.util.function.Supplier.

public default <
The type of the value consumed the specified Function.
S
>
Function<S, R>

Returns:

A Function composed of this Function and the specified Function.
compose
(Function<? super S, ? extends T>
The Function to be called to supply a value to be consumed by this Function. Must not be null.
before
)

Compose the specified Function to be called to supply a value to be consumed by this Function.

Method Detail

andThenback to summary
public default <S> Function<T, S> andThen(Function<? super R, ? extends S> after)

Compose the specified Function to be called on the value returned by this Function.

Parameters
<S>
The type of the value supplied by the specified Function.
after:Function<? super R, ? extends S>

The Function to be called on the value returned by this Function. Must not be null.

Returns:Function<T, S>

A Function composed of this Function and the specified Function.

applyback to summary
public R apply(T t) throws Exception

Applies this function to the specified argument.

Parameters
t:T

The input to this function.

Returns:R

The output of this function.

Exceptions
Exception:
An exception thrown by the method.
asFunctionback to summary
public static <T, R> Function<T, R> asFunction(Function<T, R> wrapped)

Returns a Function which wraps the specified java.util.function.Function.

Parameters
<T>
The type of the function input.
<R>
The type of the function output.
wrapped:Function<T, R>

The java.util.function.Function to wrap. Must not be null.

Returns:Function<T, R>

A Function which wraps the specified java.util.function.Function.

asJavaFunctionback to summary
public static <T, R> Function<T, R> asJavaFunction(Function<T, R> wrapped)

Returns a java.util.function.Function which wraps the specified Function and throws any thrown exceptions.

The returned java.util.function.Function will throw any exception thrown by the wrapped Function.

Parameters
<T>
The type of the function input.
<R>
The type of the function output.
wrapped:Function<T, R>

The Function to wrap. Must not be null.

Returns:Function<T, R>

A java.util.function.Function which wraps the specified Function.

asJavaFunctionOrElseback to summary
public static <T, R> Function<T, R> asJavaFunctionOrElse(Function<T, R> wrapped, R orElse)

Returns a java.util.function.Function which wraps the specified Function and the specified value.

If the the specified Function throws an Exception, the the specified value is returned.

Parameters
<T>
The type of the function input.
<R>
The type of the function output.
wrapped:Function<T, R>

The Function to wrap. Must not be null.

orElse:R

The value to return if the specified Function throws an Exception.

Returns:Function<T, R>

A java.util.function.Function which wraps the specified Function and the specified value.

asJavaFunctionOrElseGetback to summary
public static <T, R> Function<T, R> asJavaFunctionOrElseGet(Function<T, R> wrapped, Supplier<? extends R> orElseGet)

Returns a java.util.function.Function which wraps the specified Function and the specified java.util.function.Supplier.

If the the specified Function throws an Exception, the value returned by the specified java.util.function.Supplier is returned.

Parameters
<T>
The type of the function input.
<R>
The type of the function output.
wrapped:Function<T, R>

The Function to wrap. Must not be null.

orElseGet:Supplier<? extends R>

The java.util.function.Supplier to call for a return value if the specified Function throws an Exception.

Returns:Function<T, R>

A java.util.function.Function which wraps the specified Function and the specified java.util.function.Supplier.

composeback to summary
public default <S> Function<S, R> compose(Function<? super S, ? extends T> before)

Compose the specified Function to be called to supply a value to be consumed by this Function.

Parameters
<S>
The type of the value consumed the specified Function.
before:Function<? super S, ? extends T>

The Function to be called to supply a value to be consumed by this Function. Must not be null.

Returns:Function<S, R>

A Function composed of this Function and the specified Function.