BlockingDeque (Java Platform SE 7 )
boolean
add(E e)
Inserts the specified element into the queue represented by this deque (in other words, at the tail of this deque) if it is possible to do so immediately without violating capacity restrictions, returning
trueupon success and throwing an
IllegalStateExceptionif no space is currently available.
void
addFirst(E e)
Inserts the specified element at the front of this deque if it is possible to do so immediately without violating capacity restrictions, throwing an
IllegalStateExceptionif no space is currently available.
void
addLast(E e)
Inserts the specified element at the end of this deque if it is possible to do so immediately without violating capacity restrictions, throwing an
IllegalStateExceptionif no space is currently available.
boolean
contains(Object o)
Returns
trueif this deque contains the specified element.
E
element()
Retrieves, but does not remove, the head of the queue represented by this deque (in other words, the first element of this deque).
Iterator<E>
iterator()
Returns an iterator over the elements in this deque in proper sequence.
boolean
offer(E e)
Inserts the specified element into the queue represented by this deque (in other words, at the tail of this deque) if it is possible to do so immediately without violating capacity restrictions, returning
trueupon success and
falseif no space is currently available.
boolean
offer(E e,
long timeout,
TimeUnit unit)
Inserts the specified element into the queue represented by this deque (in other words, at the tail of this deque), waiting up to the specified wait time if necessary for space to become available.
boolean
offerFirst(E e)
Inserts the specified element at the front of this deque if it is possible to do so immediately without violating capacity restrictions, returning
trueupon success and
falseif no space is currently available.
boolean
offerFirst(E e,
long timeout,
TimeUnit unit)
Inserts the specified element at the front of this deque, waiting up to the specified wait time if necessary for space to become available.
boolean
offerLast(E e)
Inserts the specified element at the end of this deque if it is possible to do so immediately without violating capacity restrictions, returning
trueupon success and
falseif no space is currently available.
boolean
offerLast(E e,
long timeout,
TimeUnit unit)
Inserts the specified element at the end of this deque, waiting up to the specified wait time if necessary for space to become available.
E
peek()
Retrieves, but does not remove, the head of the queue represented by this deque (in other words, the first element of this deque), or returns
nullif this deque is empty.
E
poll()
Retrieves and removes the head of the queue represented by this deque (in other words, the first element of this deque), or returns
nullif this deque is empty.
E
poll(long timeout,
TimeUnit unit)
Retrieves and removes the head of the queue represented by this deque (in other words, the first element of this deque), waiting up to the specified wait time if necessary for an element to become available.
E
pollFirst(long timeout,
TimeUnit unit)
Retrieves and removes the first element of this deque, waiting up to the specified wait time if necessary for an element to become available.
E
pollLast(long timeout,
TimeUnit unit)
Retrieves and removes the last element of this deque, waiting up to the specified wait time if necessary for an element to become available.
void
push(E e)
Pushes an element onto the stack represented by this deque.
void
put(E e)
Inserts the specified element into the queue represented by this deque (in other words, at the tail of this deque), waiting if necessary for space to become available.
void
putFirst(E e)
Inserts the specified element at the front of this deque, waiting if necessary for space to become available.
void
putLast(E e)
Inserts the specified element at the end of this deque, waiting if necessary for space to become available.
E
remove()
Retrieves and removes the head of the queue represented by this deque (in other words, the first element of this deque).
boolean
remove(Object o)
Removes the first occurrence of the specified element from this deque.
boolean
removeFirstOccurrence(Object o)
Removes the first occurrence of the specified element from this deque.
boolean
removeLastOccurrence(Object o)
Removes the last occurrence of the specified element from this deque.
int
size()
Returns the number of elements in this deque.
E
take()
Retrieves and removes the head of the queue represented by this deque (in other words, the first element of this deque), waiting if necessary until an element becomes available.
E
takeFirst()
Retrieves and removes the first element of this deque, waiting if necessary until an element becomes available.
E
takeLast()
Retrieves and removes the last element of this deque, waiting if necessary until an element becomes available.