Interface ConcurrentCollection<T>

Type Parameters:
T - the type of objects held in this ConcurrentCollection
All Known Implementing Classes:
ConcurrentLinkedDequeCollection, ConcurrentLinkedQueueCollection, ConcurrentStackCollection, MultithreadConcurrentQueueCollection

public interface ConcurrentCollection<T>
An adapter interface to a concurrent collection that provides 4 access methods: offerFirst(T), offerLast(T), pollFirst(), and pollLast(). If the implementing subclass delegates the above methods to a Collection that does not have native implementation for offerFirst() or pollLast() it can implement these methods in the same way as offerLast() or pollFirst(), and the vice versa.
Author:
Simeon Malchev
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    offerFirst(T object)
    Adds the given object at the head of the ConcurrentCollection.
    void
    offerLast(T object)
    Adds the given object at the tail of the ConcurrentCollection.
    Polls an object from the head of the ConcurrentCollection.
    Polls an object from the tail of the ConcurrentCollection.
    int
    Returns the number of elements in this collection.
  • Method Details

    • offerFirst

      void offerFirst(T object)
      Adds the given object at the head of the ConcurrentCollection.
      Parameters:
      object - the given object
    • offerLast

      void offerLast(T object)
      Adds the given object at the tail of the ConcurrentCollection.
      Parameters:
      object - the given object
    • pollFirst

      T pollFirst()
      Polls an object from the head of the ConcurrentCollection.
      Returns:
      the head Collection object if available; null otherwise
    • pollLast

      T pollLast()
      Polls an object from the tail of the ConcurrentCollection.
      Returns:
      the tail Collection object if available; null otherwise
    • size

      int size()
      Returns the number of elements in this collection.
      Returns:
      the number of elements in this collection