API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.util.concurrent. ArrayBlockingQueue View Source
Author(s)
Doug Lea
Since
1.5
Version
Serial
Hierarchy
 Object
      AbstractCollection
          AbstractQueue
              ArrayBlockingQueue
Implements
 BlockingQueue
 Serializable
Subclasses
Description
public class ArrayBlockingQueue
  A bounded blocking queue backed by an array.
See also:   
Constructors
public ArrayBlockingQueue (int capacity)
  Creates an ArrayBlockingQueue with the given (fixed) capacity and default access policy.
public ArrayBlockingQueue (int capacity, boolean fair)
  Creates an ArrayBlockingQueue with the given (fixed) capacity and the specified access policy.
public ArrayBlockingQueue (int capacity, boolean fair, Collection<Object> c)
  Creates an ArrayBlockingQueue with the given (fixed) capacity, the specified access policy and initially containing the elements of the given collection, added in traversal order of the collection's iterator.
Methods
Hide/Show inherited methods
public boolean add ( E e) [Overrides AbstractQueue] [Specified in BlockingQueue]
  Inserts the specified element at the tail of this queue if it is possible to do so immediately without exceeding the queue's capacity, returning true upon success and throwing an IllegalStateException if this queue is full.
public boolean addAll (Collection<Object> c) [Inherited From AbstractQueue]
  Adds all of the elements in the specified collection to this queue.
public void clear () [Overrides AbstractQueue]
  Atomically removes all of the elements from this queue.
public boolean contains (Object o) [Overrides AbstractCollection] [Specified in BlockingQueue]
  Returns true if this queue contains the specified element.
public boolean containsAll (Collection<Object> c) [Inherited From AbstractCollection]
  Returns true if this collection contains all of the elements in the specified collection.
public int drainTo (Collection<Object> c) [Specified in BlockingQueue]
 
public int drainTo (Collection<Object> c, int maxElements) [Specified in BlockingQueue]
 
public E element () [Inherited From AbstractQueue]
  Retrieves, but does not remove, the head of this queue.
pack-privatefinal int inc (int i)
Circularly increment i.
public boolean isEmpty () [Inherited From AbstractCollection]
  Returns true if this collection contains no elements.
public Iterator< E> iterator () [Specified in AbstractCollection]
  Returns an iterator over the elements in this queue in proper sequence.
public boolean offer ( E e) [Specified in BlockingQueue]
  Inserts the specified element at the tail of this queue if it is possible to do so immediately without exceeding the queue's capacity, returning true upon success and false if this queue is full.
public boolean offer ( E e, long timeout, TimeUnit unit) throws InterruptedException [Specified in BlockingQueue]
  Inserts the specified element at the tail of this queue, waiting up to the specified wait time for space to become available if the queue is full.
public E peek ()
public E poll ()
public E poll (long timeout, TimeUnit unit) throws InterruptedException [Specified in BlockingQueue]
public void put ( E e) throws InterruptedException [Specified in BlockingQueue]
  Inserts the specified element at the tail of this queue, waiting for space to become available if the queue is full.
public int remainingCapacity () [Specified in BlockingQueue]
  Returns the number of additional elements that this queue can ideally (in the absence of memory or resource constraints) accept without blocking.
public E remove () [Inherited From AbstractQueue]
  Retrieves and removes the head of this queue.
public boolean remove (Object o) [Overrides AbstractCollection] [Specified in BlockingQueue]
  Removes a single instance of the specified element from this queue, if it is present.
public boolean removeAll (Collection<Object> c) [Inherited From AbstractCollection]
  Removes all of this collection's elements that are also contained in the specified collection (optional operation).
pack-private void removeAt (int i)
  Utility for remove and iterator.remove: Delete item at position i.
public boolean retainAll (Collection<Object> c) [Inherited From AbstractCollection]
  Retains only the elements in this collection that are contained in the specified collection (optional operation).
public int size () [Specified in AbstractCollection]
  Returns the number of elements in this queue.
public E take () throws InterruptedException [Specified in BlockingQueue]
public Object toArray () [Overrides AbstractCollection]
  Returns an array containing all of the elements in this queue, in proper sequence.
public T toArray ( T a) [Overrides AbstractCollection]
  Returns an array containing all of the elements in this queue, in proper sequence; the runtime type of the returned array is that of the specified array.
public String toString () [Overrides AbstractCollection]
Fields
Hide/Show inherited fields
Nested Classes
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar