Accumulator (apache-cassandra API)
Date: 2018-02-12

org.apache.cassandra.utils.concurrent

## Class Accumulator<E>

- java.lang.Object
- - org.apache.cassandra.utils.concurrent.Accumulator<E>

- Type Parameters:
    `E` -
  All Implemented Interfaces:
    java.lang.Iterable<E>

      public class Accumulator<E>
      extends java.lang.Object
      implements java.lang.Iterable<E>

  A simple append-only collection supporting an unbounded number of concurrent readers/writers, but a bounded number of items.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Accumulator(int size)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(E item)` Adds an item to the collection.
    `E` | `get(int i)`
    `boolean` | `isEmpty()`
    `java.util.Iterator<E>` | `iterator()`
    `int` | `size()`

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

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

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

      `forEach, spliterator`

- - ### Constructor Detail

    - #### Accumulator

          public Accumulator(int size)

  - ### Method Detail

    - #### add

          public void add(E item)

      Adds an item to the collection. Note it is not guaranteed to be visible on exiting the method, if another add was happening concurrently; it will be visible once all concurrent adds (which are non-blocking) complete, but it is not guaranteed that any size change occurs during the execution of any specific call.
      Parameters:
        `item` - add to collection

    - #### isEmpty

          public boolean isEmpty()

    - #### size

          public int size()

      Returns:
        the size of guaranteed-to-be-visible portion of the list

    - #### iterator

          public java.util.Iterator<E> iterator()

      Specified by:
        `iterator` in interface `java.lang.Iterable<E>`

    - #### get

          public E get(int i)

Copyright © 2018 The Apache Software Foundation