ManagedConcurrentLinkedQueue (groovy 2.4.10 API)
Date: 2017-03-14

Package: org.codehaus.groovy.util

## [Java] Class ManagedConcurrentLinkedQueue<T>

- org.codehaus.groovy.util.ManagedConcurrentLinkedQueue

- All Implemented Interfaces and Traits:
    Iterable

      public class ManagedConcurrentLinkedQueue
      extends Object

  A queue that stores values wrapped in a Reference, the type of which is determined by the provided ReferenceBundle. References stored in this queue will be removed when reference processing occurs.

  This queue is backed by a ConcurrentLinkedQueue and is thread safe. The iterator will only return non-null values (reachable) and is based on the "weakly consistent" iterator of the underlying ConcurrentLinkedQueue.

  Parameters:
    `` - the type of values to store

- - ### Constructor Summary

    Constructors
    Constructor and description
    `ManagedConcurrentLinkedQueue (ReferenceBundle bundle)` Creates an empty ManagedConcurrentLinkedQueue that will use the provided `ReferenceBundle` to store values as the given Reference type.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `void` | `add(T value)` Adds the specified value to the queue.
    `` | `boolean` | `isEmpty()` Returns `true` if this queue contains no elements.
    `` | `Iterator<T>` | `iterator()` Returns an iterator over all non-null values in this queue.
    `` | `T[]` | `toArray(T[] tArray)` Returns an array containing all values from this queue in the sequence they were added.
    `` | `List<T>` | `values()` Returns a list containing all values from this queue in the sequence they were added.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll`

- - ### Constructor Detail

    - #### public ManagedConcurrentLinkedQueue(ReferenceBundle bundle)

      Creates an empty ManagedConcurrentLinkedQueue that will use the provided `ReferenceBundle` to store values as the given Reference type.

      Parameters:
        `bundle` - used to create the appropriate Reference type for the values stored

  - ### Method Detail

    - #### public void add(T value)

      Adds the specified value to the queue.

      Parameters:
        `value` - the value to add

    - #### public boolean isEmpty()

      Returns `true` if this queue contains no elements.

      This method does not check the elements to verify they contain non-null reference values.

    - #### @Override public Iterator<T> iterator()

      Returns an iterator over all non-null values in this queue. The values should be returned in the order they were added.

    - #### public T[] toArray(T[] tArray)

      Returns an array containing all values from this queue in the sequence they were added.

      Returns:
        an array containing all non-null values in this queue
      Parameters:
        `tArray` - the array to populate if big enough, else a new array with the same runtime type

    - #### public List<T> values()

      Returns a list containing all values from this queue in the sequence they were added.