On this page

Consumers

public class org.apache.commons.lang3.function.Consumers[source]

Provides Consumer instances.

Since:

3.13.0

Methods

accept(Consumer, Object)

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

nop()

Gets the NOP Consumer singleton.

public static <T> void accept(Consumer<T> consumer, T object)[source]

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

Parameters:
  • consumer – The consumer to consume.

  • object – The object to be consumed.

Type parameters:

<T> – the type of the argument the consumer accepts.

Since:

3.15.0

@SuppressWarnings({"unchecked"}) public static <T> Consumer<T> nop()[source]

Gets the NOP Consumer singleton.

Type parameters:

<T> – type type to consume.

Returns:

The NOP Consumer singleton.