Top Description Methods
java.util.concurrent

public Interface BlockingDeque<E>

extends BlockingQueue<E>, Deque<E>
Known Direct Implementers
java.util.concurrent.LinkedBlockingDeque
Type Parameters
<E>
the type of elements held in this deque
Imports
java.util.Deque, .Iterator, .NoSuchElementException

A Deque that additionally supports blocking operations that wait for the deque to become non-empty when retrieving an element, and wait for space to become available in the deque when storing an element.

BlockingDeque methods come in four forms, with different ways of handling operations that cannot be satisfied immediately, but may be satisfied at some point in the future: one throws an exception, the second returns a special value (either null or false, depending on the operation), the third blocks the current thread indefinitely until the operation can succeed, and the fourth blocks for only a given maximum time limit before giving up. These methods are summarized in the following table:

Summary of BlockingDeque methods
First Element (Head)
Throws exception Special value Blocks Times out
Insert addFirst(e) offerFirst(e) putFirst(e) offerFirst(e, time, unit)
Remove removeFirst() pollFirst() takeFirst() pollFirst(time, unit)
Examine getFirst() peekFirst() not applicable not applicable
Last Element (Tail)
Throws exception Special value Blocks Times out
Insert addLast(e) offerLast(e) putLast(e) offerLast(e, time, unit)
Remove removeLast() pollLast() takeLast() pollLast(time, unit)
Examine getLast() peekLast() not applicable not applicable

Like any BlockingQueue, a BlockingDeque is thread safe, does not permit null elements, and may (or may not) be capacity-constrained.

A BlockingDeque implementation may be used directly as a FIFO BlockingQueue. The methods inherited from the BlockingQueue interface are precisely equivalent to BlockingDeque methods as indicated in the following table:

Comparison of BlockingQueue and BlockingDeque methods
BlockingQueue Method Equivalent BlockingDeque Method
Insert add(e) addLast(e)
offer(e) offerLast(e)
put(e) putLast(e)
offer(e, time, unit) offerLast(e, time, unit)
Remove remove() removeFirst()
poll() pollFirst()
take() takeFirst()
poll(time, unit) pollFirst(time, unit)
Examine element() getFirst()
peek() peekFirst()

Memory consistency effects: As with other concurrent collections, actions in a thread prior to placing an object into a BlockingDeque happen-before actions subsequent to the access or removal of that element from the BlockingDeque in another thread.

This interface is a member of the Java Collections Framework.

Author
Doug Lea
Since
1.6

Method Summary

Modifier and TypeMethod and Description
public boolean
add(E
the element to add
e
)

Redeclares java.util.concurrent.BlockingQueue.add, java.util.Deque.add.

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 true upon success and throwing an IllegalStateException if no space is currently available.

public void
addFirst(E
the element to add
e
)

Redeclares java.util.Deque.addFirst.

Inserts the specified element at the front of this deque if it is possible to do so immediately without violating capacity restrictions, throwing an IllegalStateException if no space is currently available.

public void
addLast(E
the element to add
e
)

Redeclares java.util.Deque.addLast.

Inserts the specified element at the end of this deque if it is possible to do so immediately without violating capacity restrictions, throwing an IllegalStateException if no space is currently available.

public boolean

Returns:

true if this deque contains the specified element
contains
(Object
object to be checked for containment in this deque
o
)

Redeclares java.util.concurrent.BlockingQueue.contains, java.util.Deque.contains.

Returns true if this deque contains the specified element.

public E

Returns:

the head of this deque
element
()

Redeclares java.util.Queue.element, java.util.Deque.element.

Retrieves, but does not remove, the head of the queue represented by this deque (in other words, the first element of this deque).

public Iterator<E>

Returns:

an iterator over the elements in this deque in proper sequence
iterator
()

Redeclares java.util.Collection.iterator, java.util.Deque.iterator.

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

public boolean
offer(E
the element to add
e
)

Redeclares java.util.concurrent.BlockingQueue.offer, java.util.Deque.offer.

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 true upon success and false if no space is currently available.

public boolean

Returns:

true if the element was added to this deque, else false
offer
(E
the element to add
e
,
long
how long to wait before giving up, in units of unit
timeout
,
TimeUnit
a TimeUnit determining how to interpret the timeout parameter
unit
)

Redeclares java.util.concurrent.BlockingQueue.offer.

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.

public boolean
offerFirst(E
the element to add
e
)

Redeclares java.util.Deque.offerFirst.

Inserts the specified element at the front of this deque if it is possible to do so immediately without violating capacity restrictions, returning true upon success and false if no space is currently available.

public boolean

Returns:

true if successful, or false if the specified waiting time elapses before space is available
offerFirst
(E
the element to add
e
,
long
how long to wait before giving up, in units of unit
timeout
,
TimeUnit
a TimeUnit determining how to interpret the timeout parameter
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.

public boolean
offerLast(E
the element to add
e
)

Redeclares java.util.Deque.offerLast.

Inserts the specified element at the end of this deque if it is possible to do so immediately without violating capacity restrictions, returning true upon success and false if no space is currently available.

public boolean

Returns:

true if successful, or false if the specified waiting time elapses before space is available
offerLast
(E
the element to add
e
,
long
how long to wait before giving up, in units of unit
timeout
,
TimeUnit
a TimeUnit determining how to interpret the timeout parameter
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.

public E

Returns:

the head of this deque, or null if this deque is empty
peek
()

Redeclares java.util.Queue.peek, java.util.Deque.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 null if this deque is empty.

public E

Returns:

the head of this deque, or null if this deque is empty
poll
()

Redeclares java.util.Queue.poll, java.util.Deque.poll.

Retrieves and removes the head of the queue represented by this deque (in other words, the first element of this deque), or returns null if this deque is empty.

public E

Returns:

the head of this deque, or null if the specified waiting time elapses before an element is available
poll
(long
how long to wait before giving up, in units of unit
timeout
,
TimeUnit
a TimeUnit determining how to interpret the timeout parameter
unit
)

Redeclares java.util.concurrent.BlockingQueue.poll.

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.

public E

Returns:

the head of this deque, or null if the specified waiting time elapses before an element is available
pollFirst
(long
how long to wait before giving up, in units of unit
timeout
,
TimeUnit
a TimeUnit determining how to interpret the timeout parameter
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.

public E

Returns:

the tail of this deque, or null if the specified waiting time elapses before an element is available
pollLast
(long
how long to wait before giving up, in units of unit
timeout
,
TimeUnit
a TimeUnit determining how to interpret the timeout parameter
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.

public void
push(E
the element to push
e
)

Redeclares java.util.Deque.push.

Pushes an element onto the stack represented by this deque (in other words, at the head of this deque) if it is possible to do so immediately without violating capacity restrictions, throwing an IllegalStateException if no space is currently available.

public void
put(E
the element to add
e
)

Redeclares java.util.concurrent.BlockingQueue.put.

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.

public void
putFirst(E
the element to add
e
)

Inserts the specified element at the front of this deque, waiting if necessary for space to become available.

public void
putLast(E
the element to add
e
)

Inserts the specified element at the end of this deque, waiting if necessary for space to become available.

public E

Returns:

the head of the queue represented by this deque
remove
()

Redeclares java.util.Queue.remove, java.util.Deque.remove.

Retrieves and removes the head of the queue represented by this deque (in other words, the first element of this deque).

public boolean

Returns:

true if this deque changed as a result of the call
remove
(Object
element to be removed from this deque, if present
o
)

Redeclares java.util.concurrent.BlockingQueue.remove, java.util.Deque.remove.

Removes the first occurrence of the specified element from this deque.

public boolean

Returns:

true if an element was removed as a result of this call
removeFirstOccurrence
(Object
element to be removed from this deque, if present
o
)

Redeclares java.util.Deque.removeFirstOccurrence.

Removes the first occurrence of the specified element from this deque.

public boolean

Returns:

true if an element was removed as a result of this call
removeLastOccurrence
(Object
element to be removed from this deque, if present
o
)

Redeclares java.util.Deque.removeLastOccurrence.

Removes the last occurrence of the specified element from this deque.

public int

Returns:

the number of elements in this deque
size
()

Redeclares java.util.Collection.size, java.util.Deque.size.

Returns the number of elements in this deque.

public E

Returns:

the head of this deque
take
()

Redeclares java.util.concurrent.BlockingQueue.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.

public E

Returns:

the head of this deque
takeFirst
()

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

public E

Returns:

the tail of this deque
takeLast
()

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

Inherited from java.util.concurrent.BlockingQueue:
drainTodrainToremainingCapacity
Inherited from java.util.Deque:
addAlldescendingIteratorgetFirstgetLastpeekFirstpeekLastpollFirstpollLastpopremoveFirstremoveLastreversed

Method Detail

addback to summary
public boolean add(E e)

Redeclares java.util.concurrent.BlockingQueue.add, java.util.Deque.add.

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 true upon success and throwing an IllegalStateException if no space is currently available. When using a capacity-restricted deque, it is generally preferable to use offer.

This method is equivalent to addLast.

Parameters
e:E

the element to add

Returns:boolean

Doc from java.util.concurrent.BlockingQueue.add.

true (as specified by Collection#add)

Exceptions
IllegalStateException:
if the element cannot be added at this time due to capacity restrictions
ClassCastException:
if the class of the specified element prevents it from being added to this deque
NullPointerException:
if the specified element is null
IllegalArgumentException:
if some property of the specified element prevents it from being added to this deque
addFirstback to summary
public void addFirst(E e)

Redeclares java.util.Deque.addFirst.

Inserts the specified element at the front of this deque if it is possible to do so immediately without violating capacity restrictions, throwing an IllegalStateException if no space is currently available. When using a capacity-restricted deque, it is generally preferable to use offerFirst.

Parameters
e:E

the element to add

Exceptions
IllegalStateException:
if the element cannot be added at this time due to capacity restrictions
ClassCastException:
if the class of the specified element prevents it from being added to this deque
NullPointerException:
if the specified element is null
IllegalArgumentException:
if some property of the specified element prevents it from being added to this deque
addLastback to summary
public void addLast(E e)

Redeclares java.util.Deque.addLast.

Inserts the specified element at the end of this deque if it is possible to do so immediately without violating capacity restrictions, throwing an IllegalStateException if no space is currently available. When using a capacity-restricted deque, it is generally preferable to use offerLast.

Parameters
e:E

the element to add

Exceptions
IllegalStateException:
if the element cannot be added at this time due to capacity restrictions
ClassCastException:
if the class of the specified element prevents it from being added to this deque
NullPointerException:
if the specified element is null
IllegalArgumentException:
if some property of the specified element prevents it from being added to this deque
containsback to summary
public boolean contains(Object o)

Redeclares java.util.concurrent.BlockingQueue.contains, java.util.Deque.contains.

Returns true if this deque contains the specified element. More formally, returns true if and only if this deque contains at least one element e such that o.equals(e).

Parameters
o:Object

object to be checked for containment in this deque

Returns:boolean

true if this deque contains the specified element

Exceptions
ClassCastException:
if the class of the specified element is incompatible with this deque (optional)
NullPointerException:
if the specified element is null (optional)
elementback to summary
public E element()

Redeclares java.util.Queue.element, java.util.Deque.element.

Retrieves, but does not remove, the head of the queue represented by this deque (in other words, the first element of this deque). This method differs from peek only in that it throws an exception if this deque is empty.

This method is equivalent to getFirst.

Returns:E

the head of this deque

Exceptions
NoSuchElementException:
if this deque is empty
iteratorback to summary
public Iterator<E> iterator()

Redeclares java.util.Collection.iterator, java.util.Deque.iterator.

Returns an iterator over the elements in this deque in proper sequence. The elements will be returned in order from first (head) to last (tail).

Returns:Iterator<E>

an iterator over the elements in this deque in proper sequence

offerback to summary
public boolean offer(E e)

Redeclares java.util.concurrent.BlockingQueue.offer, java.util.Deque.offer.

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 true upon success and false if no space is currently available. When using a capacity-restricted deque, this method is generally preferable to the add method, which can fail to insert an element only by throwing an exception.

This method is equivalent to offerLast.

Parameters
e:E

the element to add

Returns:boolean

Doc from java.util.concurrent.BlockingQueue.offer.

true if the element was added to this queue, else false

Exceptions
ClassCastException:
if the class of the specified element prevents it from being added to this deque
NullPointerException:
if the specified element is null
IllegalArgumentException:
if some property of the specified element prevents it from being added to this deque
offerback to summary
public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException

Redeclares java.util.concurrent.BlockingQueue.offer.

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.

This method is equivalent to offerLast.

Parameters
e:E

the element to add

timeout:long

Doc from java.util.concurrent.BlockingQueue.offer.

how long to wait before giving up, in units of unit

unit:TimeUnit

Doc from java.util.concurrent.BlockingQueue.offer.

a TimeUnit determining how to interpret the timeout parameter

Returns:boolean

true if the element was added to this deque, else false

Exceptions
InterruptedException:
if interrupted while waiting
ClassCastException:
if the class of the specified element prevents it from being added to this deque
NullPointerException:
if the specified element is null
IllegalArgumentException:
if some property of the specified element prevents it from being added to this deque
offerFirstback to summary
public boolean offerFirst(E e)

Redeclares java.util.Deque.offerFirst.

Inserts the specified element at the front of this deque if it is possible to do so immediately without violating capacity restrictions, returning true upon success and false if no space is currently available. When using a capacity-restricted deque, this method is generally preferable to the addFirst method, which can fail to insert an element only by throwing an exception.

Parameters
e:E

the element to add

Returns:boolean

Doc from java.util.Deque.offerFirst.

true if the element was added to this deque, else false

Exceptions
ClassCastException:
if the class of the specified element prevents it from being added to this deque
NullPointerException:
if the specified element is null
IllegalArgumentException:
if some property of the specified element prevents it from being added to this deque
offerFirstback to summary
public boolean offerFirst(E e, long timeout, TimeUnit unit) throws InterruptedException

Inserts the specified element at the front of this deque, waiting up to the specified wait time if necessary for space to become available.

Parameters
e:E

the element to add

timeout:long

how long to wait before giving up, in units of unit

unit:TimeUnit

a TimeUnit determining how to interpret the timeout parameter

Returns:boolean

true if successful, or false if the specified waiting time elapses before space is available

Exceptions
InterruptedException:
if interrupted while waiting
ClassCastException:
if the class of the specified element prevents it from being added to this deque
NullPointerException:
if the specified element is null
IllegalArgumentException:
if some property of the specified element prevents it from being added to this deque
offerLastback to summary
public boolean offerLast(E e)

Redeclares java.util.Deque.offerLast.

Inserts the specified element at the end of this deque if it is possible to do so immediately without violating capacity restrictions, returning true upon success and false if no space is currently available. When using a capacity-restricted deque, this method is generally preferable to the addLast method, which can fail to insert an element only by throwing an exception.

Parameters
e:E

the element to add

Returns:boolean

Doc from java.util.Deque.offerLast.

true if the element was added to this deque, else false

Exceptions
ClassCastException:
if the class of the specified element prevents it from being added to this deque
NullPointerException:
if the specified element is null
IllegalArgumentException:
if some property of the specified element prevents it from being added to this deque
offerLastback to summary
public boolean offerLast(E e, long timeout, TimeUnit unit) throws InterruptedException

Inserts the specified element at the end of this deque, waiting up to the specified wait time if necessary for space to become available.

Parameters
e:E

the element to add

timeout:long

how long to wait before giving up, in units of unit

unit:TimeUnit

a TimeUnit determining how to interpret the timeout parameter

Returns:boolean

true if successful, or false if the specified waiting time elapses before space is available

Exceptions
InterruptedException:
if interrupted while waiting
ClassCastException:
if the class of the specified element prevents it from being added to this deque
NullPointerException:
if the specified element is null
IllegalArgumentException:
if some property of the specified element prevents it from being added to this deque
peekback to summary
public E peek()

Redeclares java.util.Queue.peek, java.util.Deque.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 null if this deque is empty.

This method is equivalent to peekFirst.

Returns:E

the head of this deque, or null if this deque is empty

pollback to summary
public E poll()

Redeclares java.util.Queue.poll, java.util.Deque.poll.

Retrieves and removes the head of the queue represented by this deque (in other words, the first element of this deque), or returns null if this deque is empty.

This method is equivalent to pollFirst().

Returns:E

the head of this deque, or null if this deque is empty

pollback to summary
public E poll(long timeout, TimeUnit unit) throws InterruptedException

Redeclares java.util.concurrent.BlockingQueue.poll.

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.

This method is equivalent to pollFirst.

Parameters
timeout:long

Doc from java.util.concurrent.BlockingQueue.poll.

how long to wait before giving up, in units of unit

unit:TimeUnit

Doc from java.util.concurrent.BlockingQueue.poll.

a TimeUnit determining how to interpret the timeout parameter

Returns:E

the head of this deque, or null if the specified waiting time elapses before an element is available

Exceptions
InterruptedException:
if interrupted while waiting
pollFirstback to summary
public E pollFirst(long timeout, TimeUnit unit) throws InterruptedException

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

Parameters
timeout:long

how long to wait before giving up, in units of unit

unit:TimeUnit

a TimeUnit determining how to interpret the timeout parameter

Returns:E

the head of this deque, or null if the specified waiting time elapses before an element is available

Exceptions
InterruptedException:
if interrupted while waiting
pollLastback to summary
public E pollLast(long timeout, TimeUnit unit) throws InterruptedException

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

Parameters
timeout:long

how long to wait before giving up, in units of unit

unit:TimeUnit

a TimeUnit determining how to interpret the timeout parameter

Returns:E

the tail of this deque, or null if the specified waiting time elapses before an element is available

Exceptions
InterruptedException:
if interrupted while waiting
pushback to summary
public void push(E e)

Redeclares java.util.Deque.push.

Pushes an element onto the stack represented by this deque (in other words, at the head of this deque) if it is possible to do so immediately without violating capacity restrictions, throwing an IllegalStateException if no space is currently available.

This method is equivalent to addFirst.

Parameters
e:E

Doc from java.util.Deque.push.

the element to push

Exceptions
IllegalStateException:
if the element cannot be added at this time due to capacity restrictions
ClassCastException:
if the class of the specified element prevents it from being added to this deque
NullPointerException:
if the specified element is null
IllegalArgumentException:
if some property of the specified element prevents it from being added to this deque
putback to summary
public void put(E e) throws InterruptedException

Redeclares java.util.concurrent.BlockingQueue.put.

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.

This method is equivalent to putLast.

Parameters
e:E

the element to add

Exceptions
InterruptedException:
if interrupted while waiting
ClassCastException:
if the class of the specified element prevents it from being added to this deque
NullPointerException:
if the specified element is null
IllegalArgumentException:
if some property of the specified element prevents it from being added to this deque
putFirstback to summary
public void putFirst(E e) throws InterruptedException

Inserts the specified element at the front of this deque, waiting if necessary for space to become available.

Parameters
e:E

the element to add

Exceptions
InterruptedException:
if interrupted while waiting
ClassCastException:
if the class of the specified element prevents it from being added to this deque
NullPointerException:
if the specified element is null
IllegalArgumentException:
if some property of the specified element prevents it from being added to this deque
putLastback to summary
public void putLast(E e) throws InterruptedException

Inserts the specified element at the end of this deque, waiting if necessary for space to become available.

Parameters
e:E

the element to add

Exceptions
InterruptedException:
if interrupted while waiting
ClassCastException:
if the class of the specified element prevents it from being added to this deque
NullPointerException:
if the specified element is null
IllegalArgumentException:
if some property of the specified element prevents it from being added to this deque
removeback to summary
public E remove()

Redeclares java.util.Queue.remove, java.util.Deque.remove.

Retrieves and removes the head of the queue represented by this deque (in other words, the first element of this deque). This method differs from poll() only in that it throws an exception if this deque is empty.

This method is equivalent to removeFirst.

Returns:E

the head of the queue represented by this deque

Exceptions
NoSuchElementException:
if this deque is empty
removeback to summary
public boolean remove(Object o)

Redeclares java.util.concurrent.BlockingQueue.remove, java.util.Deque.remove.

Removes the first occurrence of the specified element from this deque. If the deque does not contain the element, it is unchanged. More formally, removes the first element e such that o.equals(e) (if such an element exists). Returns true if this deque contained the specified element (or equivalently, if this deque changed as a result of the call).

This method is equivalent to removeFirstOccurrence.

Parameters
o:Object

element to be removed from this deque, if present

Returns:boolean

true if this deque changed as a result of the call

Exceptions
ClassCastException:
if the class of the specified element is incompatible with this deque (optional)
NullPointerException:
if the specified element is null (optional)
removeFirstOccurrenceback to summary
public boolean removeFirstOccurrence(Object o)

Redeclares java.util.Deque.removeFirstOccurrence.

Removes the first occurrence of the specified element from this deque. If the deque does not contain the element, it is unchanged. More formally, removes the first element e such that o.equals(e) (if such an element exists). Returns true if this deque contained the specified element (or equivalently, if this deque changed as a result of the call).

Parameters
o:Object

element to be removed from this deque, if present

Returns:boolean

true if an element was removed as a result of this call

Exceptions
ClassCastException:
if the class of the specified element is incompatible with this deque (optional)
NullPointerException:
if the specified element is null (optional)
removeLastOccurrenceback to summary
public boolean removeLastOccurrence(Object o)

Redeclares java.util.Deque.removeLastOccurrence.

Removes the last occurrence of the specified element from this deque. If the deque does not contain the element, it is unchanged. More formally, removes the last element e such that o.equals(e) (if such an element exists). Returns true if this deque contained the specified element (or equivalently, if this deque changed as a result of the call).

Parameters
o:Object

element to be removed from this deque, if present

Returns:boolean

true if an element was removed as a result of this call

Exceptions
ClassCastException:
if the class of the specified element is incompatible with this deque (optional)
NullPointerException:
if the specified element is null (optional)
sizeback to summary
public int size()

Redeclares java.util.Collection.size, java.util.Deque.size.

Returns the number of elements in this deque.

Returns:int

the number of elements in this deque

takeback to summary
public E take() throws InterruptedException

Redeclares java.util.concurrent.BlockingQueue.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.

This method is equivalent to takeFirst.

Returns:E

the head of this deque

Exceptions
InterruptedException:
if interrupted while waiting
takeFirstback to summary
public E takeFirst() throws InterruptedException

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

Returns:E

the head of this deque

Exceptions
InterruptedException:
if interrupted while waiting
takeLastback to summary
public E takeLast() throws InterruptedException

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

Returns:E

the tail of this deque

Exceptions
InterruptedException:
if interrupted while waiting