ArrayBlockingQueue (Java Platform SE 8 ) (original) (raw)

Modifier and Type

Method

Description

boolean

[add](../../../java/util/concurrent/ArrayBlockingQueue.html#add-E-)([E](../../../java/util/concurrent/ArrayBlockingQueue.html "type parameter in ArrayBlockingQueue") e)

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 anIllegalStateException if this queue is full.

void

[clear](../../../java/util/concurrent/ArrayBlockingQueue.html#clear--)()

Atomically removes all of the elements from this queue.

boolean

[contains](../../../java/util/concurrent/ArrayBlockingQueue.html#contains-java.lang.Object-)([Object](../../../java/lang/Object.html "class in java.lang") o)

Returns true if this queue contains the specified element.

int

[drainTo](../../../java/util/concurrent/ArrayBlockingQueue.html#drainTo-java.util.Collection-)([Collection](../../../java/util/Collection.html "interface in java.util")<? super [E](../../../java/util/concurrent/ArrayBlockingQueue.html "type parameter in ArrayBlockingQueue")> c)

Removes all available elements from this queue and adds them to the given collection.

int

[drainTo](../../../java/util/concurrent/ArrayBlockingQueue.html#drainTo-java.util.Collection-int-)([Collection](../../../java/util/Collection.html "interface in java.util")<? super [E](../../../java/util/concurrent/ArrayBlockingQueue.html "type parameter in ArrayBlockingQueue")> c, int maxElements)

Removes at most the given number of available elements from this queue and adds them to the given collection.

[Iterator](../../../java/util/Iterator.html "interface in java.util")<[E](../../../java/util/concurrent/ArrayBlockingQueue.html "type parameter in ArrayBlockingQueue")>

[iterator](../../../java/util/concurrent/ArrayBlockingQueue.html#iterator--)()

Returns an iterator over the elements in this queue in proper sequence.

boolean

[offer](../../../java/util/concurrent/ArrayBlockingQueue.html#offer-E-)([E](../../../java/util/concurrent/ArrayBlockingQueue.html "type parameter in ArrayBlockingQueue") e)

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.

boolean

[offer](../../../java/util/concurrent/ArrayBlockingQueue.html#offer-E-long-java.util.concurrent.TimeUnit-)([E](../../../java/util/concurrent/ArrayBlockingQueue.html "type parameter in ArrayBlockingQueue") e, long timeout,[TimeUnit](../../../java/util/concurrent/TimeUnit.html "enum in java.util.concurrent") unit)

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.

[E](../../../java/util/concurrent/ArrayBlockingQueue.html "type parameter in ArrayBlockingQueue")

[peek](../../../java/util/concurrent/ArrayBlockingQueue.html#peek--)()

Retrieves, but does not remove, the head of this queue, or returns null if this queue is empty.

[E](../../../java/util/concurrent/ArrayBlockingQueue.html "type parameter in ArrayBlockingQueue")

[poll](../../../java/util/concurrent/ArrayBlockingQueue.html#poll--)()

Retrieves and removes the head of this queue, or returns null if this queue is empty.

[E](../../../java/util/concurrent/ArrayBlockingQueue.html "type parameter in ArrayBlockingQueue")

[poll](../../../java/util/concurrent/ArrayBlockingQueue.html#poll-long-java.util.concurrent.TimeUnit-)(long timeout,[TimeUnit](../../../java/util/concurrent/TimeUnit.html "enum in java.util.concurrent") unit)

Retrieves and removes the head of this queue, waiting up to the specified wait time if necessary for an element to become available.

void

[put](../../../java/util/concurrent/ArrayBlockingQueue.html#put-E-)([E](../../../java/util/concurrent/ArrayBlockingQueue.html "type parameter in ArrayBlockingQueue") e)

Inserts the specified element at the tail of this queue, waiting for space to become available if the queue is full.

int

[remainingCapacity](../../../java/util/concurrent/ArrayBlockingQueue.html#remainingCapacity--)()

Returns the number of additional elements that this queue can ideally (in the absence of memory or resource constraints) accept without blocking.

boolean

[remove](../../../java/util/concurrent/ArrayBlockingQueue.html#remove-java.lang.Object-)([Object](../../../java/lang/Object.html "class in java.lang") o)

Removes a single instance of the specified element from this queue, if it is present.

int

[size](../../../java/util/concurrent/ArrayBlockingQueue.html#size--)()

Returns the number of elements in this queue.

[Spliterator](../../../java/util/Spliterator.html "interface in java.util")<[E](../../../java/util/concurrent/ArrayBlockingQueue.html "type parameter in ArrayBlockingQueue")>

[spliterator](../../../java/util/concurrent/ArrayBlockingQueue.html#spliterator--)()

Returns a Spliterator over the elements in this queue.

[E](../../../java/util/concurrent/ArrayBlockingQueue.html "type parameter in ArrayBlockingQueue")

[take](../../../java/util/concurrent/ArrayBlockingQueue.html#take--)()

Retrieves and removes the head of this queue, waiting if necessary until an element becomes available.

[Object](../../../java/lang/Object.html "class in java.lang")[]

[toArray](../../../java/util/concurrent/ArrayBlockingQueue.html#toArray--)()

Returns an array containing all of the elements in this queue, in proper sequence.

<T> T[]

[toArray](../../../java/util/concurrent/ArrayBlockingQueue.html#toArray-T:A-)(T[] a)

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.

[String](../../../java/lang/String.html "class in java.lang")

[toString](../../../java/util/concurrent/ArrayBlockingQueue.html#toString--)()

Returns a string representation of this collection.