E - the type of elements in this collectionpublic interface Deque<E> extends Queue<E>
| Modifier and Type | Method and Description | 
|---|---|
void | 
addFirst(E e)
Inserts an element at the head of this deque if it dose not violate size
 limit immediately. 
 | 
void | 
addLast(E e)
Inserts an element at the tail of this deque if it dose not violate size
 limit immediately. 
 | 
Iterator<E> | 
descendingIterator()
Returns the iterator in reverse order, from tail to head. 
 | 
E | 
getFirst()
Gets but not removes the head element of this deque. 
 | 
E | 
getLast()
Gets but not removes the tail element of this deque. 
 | 
boolean | 
offerFirst(E e)
Inserts an element at the head of this deque unless it would violate size
 limit. 
 | 
boolean | 
offerLast(E e)
Inserts an element at the tail of this deque unless it would violate size
 limit. 
 | 
E | 
peekFirst()
Gets but not removes the head element of this deque. 
 | 
E | 
peekLast()
Gets but not removes the tail element of this deque. 
 | 
E | 
pollFirst()
Gets and removes the head element of this deque. 
 | 
E | 
pollLast()
Gets and removes the tail element of this deque. 
 | 
E | 
pop()
Pops the head element of the deque, just same as removeFirst(). 
 | 
void | 
push(E e)
Pushes the element to the deque(at the head of the deque), just same as
 addFirst(E). 
 | 
E | 
removeFirst()
Gets and removes the head element of this deque. 
 | 
boolean | 
removeFirstOccurrence(Object o)
Removes the first equivalent element of the specified object. 
 | 
E | 
removeLast()
Gets and removes the tail element of this deque. 
 | 
boolean | 
removeLastOccurrence(Object o)
Removes the last equivalent element of the specified object. 
 | 
void addFirst(E e)
e - the elementIllegalStateException - if it can not add now due to size limitClassCastException - if the class of element can not be added into this dequeNullPointerException - if the element is null and the deque can not contain null
             elementIllegalArgumentException - if the element can not be added due to some property.void addLast(E e)
e - the elementIllegalStateException - if it can not add now due to size limitClassCastException - if the class of element can not be added into this dequeNullPointerException - if the element is null and the deque can not contain null
             elementIllegalArgumentException - if the element can not be added due to some property.boolean offerFirst(E e)
e - the elementClassCastException - if the class of element can not be added into this dequeNullPointerException - if the element is null and the deque can not contain null
             elementIllegalArgumentException - if the element can not be added due to some property.boolean offerLast(E e)
e - the elementClassCastException - if the class of element can not be added into this dequeNullPointerException - if the element is null and the deque can not contain null
             elementIllegalArgumentException - if the element can not be added due to some propertyE removeFirst()
NoSuchElementException - if the deque is emptyE removeLast()
NoSuchElementException - if the deque is emptyE pollFirst()
E pollLast()
E getFirst()
NoSuchElementException - if the deque is emptyE getLast()
NoSuchElementException - if the deque is emptyE peekFirst()
E peekLast()
boolean removeFirstOccurrence(Object o)
o - the element to be removedClassCastException - if the class of the element is incompatible with the dequeNullPointerException - if the element is null and the deque can not contain null
             elementboolean removeLastOccurrence(Object o)
o - the element to be removedClassCastException - if the class of the element is incompatible with the dequeNullPointerException - if the element is null and the deque can not contain null
             elementvoid push(E e)
e - the elementIllegalStateException - if it can not add now due to size limitClassCastException - if the class of element can not be added into this dequeNullPointerException - if the element is null and the deque can not contain null
             elementIllegalArgumentException - if the element can not be added due to some property.E pop()
NoSuchElementException - if the deque is empty