DelayQueue (Java Platform SE 7 ) (original) (raw)

Modifier and Type

Method and Description

boolean

**[add](../../../java/util/concurrent/DelayQueue.html#add%28E%29)**([E](../../../java/util/concurrent/DelayQueue.html "type parameter in DelayQueue") e)

Inserts the specified element into this delay queue.

void

**[clear](../../../java/util/concurrent/DelayQueue.html#clear%28%29)**()

Atomically removes all of the elements from this delay queue.

int

**[drainTo](../../../java/util/concurrent/DelayQueue.html#drainTo%28java.util.Collection%29)**([Collection](../../../java/util/Collection.html "interface in java.util")<? super [E](../../../java/util/concurrent/DelayQueue.html "type parameter in DelayQueue")> c)

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

int

**[drainTo](../../../java/util/concurrent/DelayQueue.html#drainTo%28java.util.Collection,%20int%29)**([Collection](../../../java/util/Collection.html "interface in java.util")<? super [E](../../../java/util/concurrent/DelayQueue.html "type parameter in DelayQueue")> 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/DelayQueue.html "type parameter in DelayQueue")>

**[iterator](../../../java/util/concurrent/DelayQueue.html#iterator%28%29)**()

Returns an iterator over all the elements (both expired and unexpired) in this queue.

boolean

**[offer](../../../java/util/concurrent/DelayQueue.html#offer%28E%29)**([E](../../../java/util/concurrent/DelayQueue.html "type parameter in DelayQueue") e)

Inserts the specified element into this delay queue.

boolean

**[offer](../../../java/util/concurrent/DelayQueue.html#offer%28E,%20long,%20java.util.concurrent.TimeUnit%29)**([E](../../../java/util/concurrent/DelayQueue.html "type parameter in DelayQueue") e, long timeout,[TimeUnit](../../../java/util/concurrent/TimeUnit.html "enum in java.util.concurrent") unit)

Inserts the specified element into this delay queue.

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

**[peek](../../../java/util/concurrent/DelayQueue.html#peek%28%29)**()

Retrieves, but does not remove, the head of this queue, or returns

null

if this queue is empty.

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

**[poll](../../../java/util/concurrent/DelayQueue.html#poll%28%29)**()

Retrieves and removes the head of this queue, or returns

null

if this queue has no elements with an expired delay.

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

**[poll](../../../java/util/concurrent/DelayQueue.html#poll%28long,%20java.util.concurrent.TimeUnit%29)**(long timeout,[TimeUnit](../../../java/util/concurrent/TimeUnit.html "enum in java.util.concurrent") unit)

Retrieves and removes the head of this queue, waiting if necessary until an element with an expired delay is available on this queue, or the specified wait time expires.

void

**[put](../../../java/util/concurrent/DelayQueue.html#put%28E%29)**([E](../../../java/util/concurrent/DelayQueue.html "type parameter in DelayQueue") e)

Inserts the specified element into this delay queue.

int

**[remainingCapacity](../../../java/util/concurrent/DelayQueue.html#remainingCapacity%28%29)**()

Always returns

Integer.MAX_VALUE

because a

DelayQueue

is not capacity constrained.

boolean

**[remove](../../../java/util/concurrent/DelayQueue.html#remove%28java.lang.Object%29)**([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, whether or not it has expired.

int

**[size](../../../java/util/concurrent/DelayQueue.html#size%28%29)**()

Returns the number of elements in this collection.

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

**[take](../../../java/util/concurrent/DelayQueue.html#take%28%29)**()

Retrieves and removes the head of this queue, waiting if necessary until an element with an expired delay is available on this queue.

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

**[toArray](../../../java/util/concurrent/DelayQueue.html#toArray%28%29)**()

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

<T> T[]

**[toArray](../../../java/util/concurrent/DelayQueue.html#toArray%28T[]%29)**(T[] a)

Returns an array containing all of the elements in this queue; the runtime type of the returned array is that of the specified array.