Top Description Fields Constructors Methods
org.apache.commons.lang3.function

public Class Consumers

extends Object
Class Inheritance
Imports
java.util.function.Consumer, .Function

Provides Consumer instances.
Since
3.13.0

Field Summary

Modifier and TypeField and Description
private static final Consumer<T>
NOP

NOP singleton.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static <
the type of the argument the consumer accepts.
T
>
void
accept(final Consumer<T>
the consumer to consume.
consumer
,
final T
the object to be consumed.
object
)

Applies the given Consumer action to the object if the consumer is not null.

public static <
type type to consume.
T
>
Consumer<T>

Returns:

the NOP Consumer singleton.
nop
()

Gets the NOP Consumer singleton.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

NOPback to summary
private static final Consumer<T> NOP

NOP singleton.

Annotations
@SuppressWarnings:rawtypes

Constructor Detail

Consumersback to summary
private Consumers()

Method Detail

acceptback to summary
public static <T> void accept(final Consumer<T> consumer, final T object)

Applies the given Consumer action to the object if the consumer is not null. Otherwise, does nothing.

Parameters
<T>
the type of the argument the consumer accepts.
consumer:Consumer<T>

the consumer to consume.

object:T

the object to be consumed.

Since
3.15.0
nopback to summary
public static <T> Consumer<T> nop()

Gets the NOP Consumer singleton.

Parameters
<T>
type type to consume.
Returns:Consumer<T>

the NOP Consumer singleton.

Annotations
@SuppressWarnings:unchecked