Type Parameters:
E - the type of elements held in this deque
All Superinterfaces:
Collection<E>, Iterable<E>, Queue<E>, SequencedCollection<E>
All Known Subinterfaces:
BlockingDeque<E>
All Known Implementing Classes:
ArrayDeque, ConcurrentLinkedDeque, LinkedBlockingDeque, LinkedList

  • Method Summary

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

    boolean

    Adds all of the elements in the specified collection at the end of this deque, as if by calling addLast(E) on each one, in the order that they are returned by the collection's iterator.

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

    boolean

    Returns true if this deque contains the specified element.

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

    element()

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

    getFirst()

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

    getLast()

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

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

    boolean

    offerFirst(E e)

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

    boolean

    offerLast(E e)

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

    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.

    peekFirst()

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

    peekLast()

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

    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.

    pollFirst()

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

    pollLast()

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

    pop()

    Pops an element from the stack represented by this deque.

    void

    push(E 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 an IllegalStateException if no space is currently available.

    remove()

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

    boolean

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

    Retrieves and removes the first element of this deque.

    boolean

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

    Retrieves and removes the last element of this deque.

    boolean

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

    reversed()

    Returns a reverse-ordered view of this collection.

    int

    size()

    Returns the number of elements in this deque.

    Methods declared in interface Collection

    clear, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArray

    void

    Removes all of the elements from this collection (optional operation).

    boolean

    Returns true if this collection contains all of the elements in the specified collection.

    boolean

    Compares the specified object with this collection for equality.

    int

    Returns the hash code value for this collection.

    boolean

    Returns true if this collection contains no elements.

    Returns a possibly parallel Stream with this collection as its source.

    boolean

    Removes all of this collection's elements that are also contained in the specified collection (optional operation).

    default boolean

    Removes all of the elements of this collection that satisfy the given predicate (optional operation).

    boolean

    Retains only the elements in this collection that are contained in the specified collection (optional operation).

    Creates a Spliterator over the elements in this collection.

    Returns a sequential Stream with this collection as its source.

    Returns an array containing all of the elements in this collection.

    default <T> T[]

    Returns an array containing all of the elements in this collection, using the provided generator function to allocate the returned array.

    <T> T[]

    Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified array.

    Methods declared in interface Iterable

    forEach

    default void

    Performs the given action for each element of the Iterable until all elements have been processed or the action throws an exception.

  • Method Details

    • addFirst

    • addLast

    • offerFirst

    • offerLast

    • removeFirst

    • removeLast

    • pollFirst

    • pollLast

    • getFirst

    • getLast

    • peekFirst

    • peekLast

    • removeFirstOccurrence

    • removeLastOccurrence

    • add

    • offer

    • remove

    • poll

    • element

    • peek

    • addAll

    • push

    • pop

    • remove

    • contains

    • size

    • iterator

    • descendingIterator

    • reversed