Package com.norconex.commons.lang.function

# Class Consumers<T>

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<Consumer<T>>
com.norconex.commons.lang.function.Consumers<T>

Type Parameters:
  `T` - type being consumed by all consumers

All Implemented Interfaces:
  `Serializable`, `Cloneable`, `Iterable<Consumer<T>>`, `Collection<Consumer<T>>`, `Consumer<T>`, `List<Consumer<T>>`, `RandomAccess`

public class Consumers<T> extends ArrayList<Consumer<T>> implements Consumer<T>

A list of `Consumer` instances, each triggered sequentially when this one is.

Any `null` consumers are simply ignored.

Since:
  2.0.0
See Also:
  - Serialized Form

- ## Field Summary

  ### Fields inherited from class java.util.AbstractList

  `modCount`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Consumers()`
  `Consumers(int initialCapacity)`
  `Consumers(Collection<? extends Consumer<T>> consumers)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final void`
  `accept(T t)`
  `protected boolean`
  `canEqual(Object other)`
  `boolean`
  `equals(Object o)`
  `int`
  `hashCode()`
  `static <T> Consumers<T>`
  `of(@NonNull Consumer<T>... consumers)`
  A group of consumers.
  `String`
  `toString()`

  ### Methods inherited from class java.util.ArrayList

  `add, add, addAll, addAll, clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize`

  ### Methods inherited from class java.util.AbstractCollection

  `containsAll`

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

  `finalize, getClass, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface java.util.Collection

  `parallelStream, stream, toArray`

  ### Methods inherited from interface java.util.function.Consumer

  `andThen`

  ### Methods inherited from interface java.util.List

  `containsAll`

- ## Constructor Details

  - ### Consumers

    public Consumers()

  - ### Consumers

    public Consumers(int initialCapacity)

  - ### Consumers

    public Consumers(Collection<? extends Consumer<T>> consumers)

- ## Method Details

  - ### accept

    public final void accept(T t)
    Specified by:
      `accept` in interface `Consumer<T>`

  - ### of

    @SafeVarargs public static <T> Consumers<T> of(@NonNull @NonNull Consumer<T>... consumers)
    A group of consumers. All consumers are invoked.
    Type Parameters:
      `T` - type of object consumed
    Parameters:
      `consumers` - consumers
    Returns:
      a consumer group
    Since:
      3.0.0

  - ### equals

    public boolean equals(Object o)
    Specified by:
      `equals` in interface `Collection<T>`
    Specified by:
      `equals` in interface `List<T>`
    Overrides:
      `equals` in class `ArrayList<Consumer<T>>`

  - ### canEqual

    protected boolean canEqual(Object other)

  - ### hashCode

    public int hashCode()
    Specified by:
      `hashCode` in interface `Collection<T>`
    Specified by:
      `hashCode` in interface `List<T>`
    Overrides:
      `hashCode` in class `ArrayList<Consumer<T>>`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `AbstractCollection<Consumer<T>>`