public class CircularBlockingDeque<T>
extends java.lang.Object
implements java.lang.Iterable<T>
takeFirst() and takeLast() when
there are no elements available.| Constructor and Description |
|---|
CircularBlockingDeque(int capacity) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addFirst(T entry)
Adds the specified entry to the tail of the queue, overwriting older
entries if necessary.
|
boolean |
addLast(T entry)
Adds the specified entry to the tail of the queue, overwriting older
entries if necessary.
|
boolean |
isEmpty() |
java.util.Iterator<T> |
iterator()
Returns an iterator over the queue.
|
T |
peekFirst()
Retrieves, but does not remove, the head of this queue, returning
null if this queue is empty. |
T |
peekLast()
Retrieves, but does not remove, the tail of this queue, returning
null if this queue is empty. |
T |
takeFirst()
Retrieves the head of the queue, blocking if necessary until an entry is
available.
|
T |
takeLast()
Retrieves the tail of the queue, blocking if necessary until an entry is
available.
|
public CircularBlockingDeque(int capacity)
capacity - the maximum number of elements allowed in the queuepublic boolean addLast(T entry)
entry - the entry to addtruepublic boolean addFirst(T entry)
entry - the entry to addtruepublic T takeFirst() throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic T peekFirst()
null if this queue is empty.null if this queue is emptypublic T takeLast() throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic T peekLast()
null if this queue is empty.null if this queue is emptypublic boolean isEmpty()