Type Parameters:
E - the type of elements held in this deque
All Implemented Interfaces:
Serializable, Cloneable, Iterable<E>, Collection<E>, Deque<E>, Queue<E>, SequencedCollection<E>

  • Constructor Summary

    Constructors

    Constructs an empty array deque with an initial capacity sufficient to hold 16 elements.

    ArrayDeque(int numElements)

    Constructs an empty array deque with an initial capacity sufficient to hold the specified number of elements.

    Constructs a deque containing the elements of the specified collection, in the order they are returned by the collection's iterator.

  • Method Summary

    boolean

    add(E e)

    Inserts the specified element at the end of this deque.

    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.

    void

    addLast(E e)

    Inserts the specified element at the end of this deque.

    void

    clear()

    Removes all of the elements from this deque.

    clone()

    Returns a copy of this deque.

    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.

    void

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

    getFirst()

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

    getLast()

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

    boolean

    isEmpty()

    Returns true if this deque contains no elements.

    iterator()

    Returns an iterator over the elements in this deque.

    boolean

    offer(E e)

    Inserts the specified element at the end of this deque.

    boolean

    offerFirst(E e)

    Inserts the specified element at the front of this deque.

    boolean

    offerLast(E e)

    Inserts the specified element at the end of this deque.

    peek()

    Retrieves, but does not remove, the head of the queue represented by 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.

    remove()

    Retrieves and removes the head of the queue represented by this deque.

    boolean

    Removes a single instance of the specified element from this deque.

    boolean

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

    Retrieves and removes the first element of this deque.

    boolean

    Removes the first occurrence of the specified element in this deque (when traversing the deque from head to tail).

    boolean

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

    Retrieves and removes the last element of this deque.

    boolean

    Removes the last occurrence of the specified element in this deque (when traversing the deque from head to tail).

    boolean

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

    int

    size()

    Returns the number of elements in this deque.

    toArray()

    Returns an array containing all of the elements in this deque in proper sequence (from first to last element).

    <T> T[]

    toArray(T[] a)

    Returns an array containing all of the elements in this deque in proper sequence (from first to last element); the runtime type of the returned array is that of the specified array.

    Methods declared in class AbstractCollection

    containsAll, toString

    boolean

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

    Returns a string representation of this collection.

    Methods declared in class Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    boolean

    Indicates whether some other object is "equal to" this one.

    protected void

    Deprecated, for removal: This API element is subject to removal in a future version.

    Returns the runtime class of this Object.

    int

    Returns a hash code value for this object.

    final void

    Wakes up a single thread that is waiting on this object's monitor.

    final void

    Wakes up all threads that are waiting on this object's monitor.

    final void

    Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

    final void

    wait(long timeoutMillis)

    Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

    final void

    wait(long timeoutMillis, int nanos)

    Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

    Methods declared in interface Collection

    equals, hashCode, parallelStream, stream, toArray

    boolean

    Compares the specified object with this collection for equality.

    int

    Returns the hash code value for this collection.

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

    Returns a sequential Stream with this collection as its source.

    default <T> T[]

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

    Methods declared in interface Deque

    reversed

    Returns a reverse-ordered view of this collection.

  • Constructor Details

    • ArrayDeque

    • ArrayDeque

    • ArrayDeque

  • Method Details

    • addFirst

    • addLast

    • addAll

    • offerFirst

    • offerLast

    • removeFirst

    • removeLast

    • pollFirst

    • pollLast

    • getFirst

    • getLast

    • peekFirst

    • peekLast

    • removeFirstOccurrence

    • removeLastOccurrence

    • add

    • offer

    • remove

    • poll

    • element

    • peek

    • push

    • pop

    • size

    • isEmpty

    • iterator

    • descendingIterator

    • spliterator

    • forEach

    • removeIf

    • removeAll

    • retainAll

    • contains

    • remove

    • clear

    • toArray

    • toArray

    • clone