Class Consumers
- java.lang.Object
-
- org.apache.commons.lang3.function.Consumers
-
public class Consumers extends java.lang.Object
ProvidesConsumer
instances.- Since:
- 3.13.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> void
accept(java.util.function.Consumer<T> consumer, T object)
Applies the givenConsumer
action to the object if the consumer is notnull
.static <T> java.util.function.Consumer<T>
nop()
Gets the NOP Consumer singleton.
-
-
-
Method Detail
-
accept
public static <T> void accept(java.util.function.Consumer<T> consumer, T object)
Applies the givenConsumer
action to the object if the consumer is notnull
. Otherwise, does nothing.- Type Parameters:
T
- the type of the argument the consumer accepts.- Parameters:
consumer
- the consumer to consume.object
- the object to be consumed.- Since:
- 3.15.0
-
nop
public static <T> java.util.function.Consumer<T> nop()
Gets the NOP Consumer singleton.- Type Parameters:
T
- type type to consume.- Returns:
- the NOP Consumer singleton.
-
-