Top Description Methods
org.osgi.util.function

public Interface Consumer<T>

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

A function that accepts a single argument and produces no result.

This is a functional interface and can be used as the assignment target for a lambda expression or method reference.

Author
$Id: de119bd081d573a23401845cea9ca266bd48e159 $
Since
1.1

Method Summary

Modifier and TypeMethod and Description
public void
accept(T
The input to this function.
t
)

Applies this function to the specified argument.

public default Consumer<T>

Returns:

A Consumer composed of this Consumer and the specified Consumer.
andThen
(Consumer<? super T>
The Consumer to be called after this Consumer is called. Must not be null.
after
)

Compose the specified Consumer to be called after this Consumer.

public static <
The type of the function input.
T
>
Consumer<T>

Returns:

A Consumer which wraps the specified java.util.function.Consumer.
asConsumer
(Consumer<T>
The java.util.function.Consumer to wrap. Must not be null.
wrapped
)

Returns a Consumer which wraps a java.util.function.Consumer.

public static <
The type of the function input.
T
>
Consumer<T>

Returns:

A java.util.function.Consumer which wraps the specified Consumer.
asJavaConsumer
(Consumer<T>
The Consumer to wrap. Must not be null.
wrapped
)

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

public static <
The type of the function input.
T
>
Consumer<T>

Returns:

A java.util.function.Consumer which wraps the specified Consumer.
asJavaConsumerIgnoreException
(Consumer<T>
The Consumer to wrap. Must not be null.
wrapped
)

Returns a java.util.function.Consumer which wraps the specified Consumer and discards any thrown Exceptions.

Method Detail

acceptback to summary
public void accept(T t) throws Exception

Applies this function to the specified argument.

Parameters
t:T

The input to this function.

Exceptions
Exception:
An exception thrown by the method.
andThenback to summary
public default Consumer<T> andThen(Consumer<? super T> after)

Compose the specified Consumer to be called after this Consumer.

Parameters
after:Consumer<? super T>

The Consumer to be called after this Consumer is called. Must not be null.

Returns:Consumer<T>

A Consumer composed of this Consumer and the specified Consumer.

asConsumerback to summary
public static <T> Consumer<T> asConsumer(Consumer<T> wrapped)

Returns a Consumer which wraps a java.util.function.Consumer.

Parameters
<T>
The type of the function input.
wrapped:Consumer<T>

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

Returns:Consumer<T>

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

asJavaConsumerback to summary
public static <T> Consumer<T> asJavaConsumer(Consumer<T> wrapped)

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

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

Parameters
<T>
The type of the function input.
wrapped:Consumer<T>

The Consumer to wrap. Must not be null.

Returns:Consumer<T>

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

asJavaConsumerIgnoreExceptionback to summary
public static <T> Consumer<T> asJavaConsumerIgnoreException(Consumer<T> wrapped)

Returns a java.util.function.Consumer which wraps the specified Consumer and discards any thrown Exceptions.

The returned java.util.function.Consumer will discard any Exception thrown by the wrapped Consumer.

Parameters
<T>
The type of the function input.
wrapped:Consumer<T>

The Consumer to wrap. Must not be null.

Returns:Consumer<T>

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