Consumers (Apache Commons Lang 3.17.0 API)
Description: declaration: package: org.apache.commons.lang3.function, class: Consumers

Package org.apache.commons.lang3.function

# Class Consumers

java.lang.Object
org.apache.commons.lang3.function.Consumers

public class Consumers extends Object
Provides `Consumer` instances.

Since:
  3.13.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static <T> void`
  `accept(Consumer<T> consumer, T object)`
  Applies the given `Consumer` action to the object if the consumer is not `null`.
  `static <T> Consumer<T>`
  `nop()`
  Gets the NOP Consumer singleton.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### accept

    public static <T> void accept(Consumer<T> consumer, T object)
    Applies the given `Consumer` action to the object if the consumer is not `null`. 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> Consumer<T> nop()
    Gets the NOP Consumer singleton.
    Type Parameters:
      `T` - type type to consume.
    Returns:
      the NOP Consumer singleton.