Package ghidra.util.datastruct

# Interface Accumulator<T>

Type Parameters:
  `T` - the type

All Superinterfaces:
  `Consumer<T>`, `Iterable<T>`

All Known Implementing Classes:
  `CallbackAccumulator`, `FilteringAccumulatorWrapper`, `ListAccumulator`, `SetAccumulator`, `SizeLimitedAccumulatorWrapper`, `SizeRestrictedAccumulatorWrapper`, `SynchronizedListAccumulator`

public interface Accumulator<T> extends Iterable<T>, Consumer<T>
The interface provides a mechanism for clients to pass around an object that is effectively a 'results object', into which data can be placed as it is discovered.

Historically, clients that load data will return results, once fully loaded, in a `Collection`. This has the drawback that the discovered data cannot be used until all searching is complete. This interface can now be passed into such a method (as opposed to be returned by it) so that the client can make use of data as it is discovered. This allows for long searching processes to report data as they work.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `default void`
  `accept(T t)`
  `void`
  `add(T t)`
  `void`
  `addAll(Collection<T> collection)`
  `boolean`
  `contains(T t)`
  `Collection<T>`
  `get()`
  `default boolean`
  `isEmpty()`
  `int`
  `size()`
  `default Stream<T>`
  `stream()`

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

  `andThen`

  ### Methods inherited from interface java.lang.Iterable

  `forEach, iterator, spliterator`

- ## Method Details

  - ### add

    void add(T t)

  - ### addAll

    void addAll(Collection<T> collection)

  - ### contains

    boolean contains(T t)

  - ### get

    Collection<T> get()

  - ### size

    int size()

  - ### isEmpty

    default boolean isEmpty()

  - ### stream

    default Stream<T> stream()

  - ### accept

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