Deque (Java Platform SE 8 ) (original) (raw)

Modifier and Type

Method

Description

boolean

[add](../../java/util/Deque.html#add-E-)([E](../../java/util/Deque.html "type parameter in Deque") 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, returningtrue upon success and throwing anIllegalStateException if no space is currently available.

void

[addFirst](../../java/util/Deque.html#addFirst-E-)([E](../../java/util/Deque.html "type parameter in Deque") 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 IllegalStateException if no space is currently available.

void

[addLast](../../java/util/Deque.html#addLast-E-)([E](../../java/util/Deque.html "type parameter in Deque") 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 IllegalStateException if no space is currently available.

boolean

[contains](../../java/util/Deque.html#contains-java.lang.Object-)([Object](../../java/lang/Object.html "class in java.lang") o)

Returns true if this deque contains the specified element.

[Iterator](../../java/util/Iterator.html "interface in java.util")<[E](../../java/util/Deque.html "type parameter in Deque")>

[descendingIterator](../../java/util/Deque.html#descendingIterator--)()

Returns an iterator over the elements in this deque in reverse sequential order.

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

[element](../../java/util/Deque.html#element--)()

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

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

[getFirst](../../java/util/Deque.html#getFirst--)()

Retrieves, but does not remove, the first element of this deque.

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

[getLast](../../java/util/Deque.html#getLast--)()

Retrieves, but does not remove, the last element of this deque.

[Iterator](../../java/util/Iterator.html "interface in java.util")<[E](../../java/util/Deque.html "type parameter in Deque")>

[iterator](../../java/util/Deque.html#iterator--)()

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

boolean

[offer](../../java/util/Deque.html#offer-E-)([E](../../java/util/Deque.html "type parameter in Deque") 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, returningtrue upon success and false if no space is currently available.

boolean

[offerFirst](../../java/util/Deque.html#offerFirst-E-)([E](../../java/util/Deque.html "type parameter in Deque") e)

Inserts the specified element at the front of this deque unless it would violate capacity restrictions.

boolean

[offerLast](../../java/util/Deque.html#offerLast-E-)([E](../../java/util/Deque.html "type parameter in Deque") e)

Inserts the specified element at the end of this deque unless it would violate capacity restrictions.

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

[peek](../../java/util/Deque.html#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.

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

[peekFirst](../../java/util/Deque.html#peekFirst--)()

Retrieves, but does not remove, the first element of this deque, or returns null if this deque is empty.

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

[peekLast](../../java/util/Deque.html#peekLast--)()

Retrieves, but does not remove, the last element of this deque, or returns null if this deque is empty.

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

[poll](../../java/util/Deque.html#poll--)()

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

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

[pollFirst](../../java/util/Deque.html#pollFirst--)()

Retrieves and removes the first element of this deque, or returns null if this deque is empty.

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

[pollLast](../../java/util/Deque.html#pollLast--)()

Retrieves and removes the last element of this deque, or returns null if this deque is empty.

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

[pop](../../java/util/Deque.html#pop--)()

Pops an element from the stack represented by this deque.

void

[push](../../java/util/Deque.html#push-E-)([E](../../java/util/Deque.html "type parameter in Deque") e)

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 anIllegalStateException if no space is currently available.

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

[remove](../../java/util/Deque.html#remove--)()

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

boolean

[remove](../../java/util/Deque.html#remove-java.lang.Object-)([Object](../../java/lang/Object.html "class in java.lang") o)

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

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

[removeFirst](../../java/util/Deque.html#removeFirst--)()

Retrieves and removes the first element of this deque.

boolean

[removeFirstOccurrence](../../java/util/Deque.html#removeFirstOccurrence-java.lang.Object-)([Object](../../java/lang/Object.html "class in java.lang") o)

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

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

[removeLast](../../java/util/Deque.html#removeLast--)()

Retrieves and removes the last element of this deque.

boolean

[removeLastOccurrence](../../java/util/Deque.html#removeLastOccurrence-java.lang.Object-)([Object](../../java/lang/Object.html "class in java.lang") o)

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

int

[size](../../java/util/Deque.html#size--)()

Returns the number of elements in this deque.