LinkedDeque interface to minimize
the effort required to implement this interface.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv abstract class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv @Nullable E | first
Pointer to first node. |
| pack-priv @Nullable E | last
Pointer to last node. |
| pack-priv int | modCount
The number of times this deque has been structurally modified. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | add(E
the element to add e)Overrides java. Implements java. true upon success and throwing an
IllegalStateException if no space is currently available.
|
| public void | addFirst(E
the element to add e)Implements java. IllegalStateException if no space is currently
available.
|
| public void | addLast(E
the element to add e)Implements java. IllegalStateException if no space is currently
available.
|
| pack-priv void | |
| public void | clear()
Overrides java. Implements java. |
| public abstract boolean | contains(Object
element whose presence in this deque is to be tested o)Redeclares java. Overrides java. true if this deque contains the specified element.
|
| public LinkedDeque. | descendingIterator()
Implements com. |
| public E | element()
Implements java. |
| public E | getFirst()
Implements java. |
| public E | getLast()
Implements java. |
| public boolean | isEmpty()
Overrides java. Implements java. true if this collection contains no elements.
|
| public boolean | isFirst(E
the linked element e)Implements com. |
| public boolean | isLast(E
the linked element e)Implements com. |
| public LinkedDeque. | iterator()
Implements abstract java. Implements com. |
| pack-priv void | linkFirst(final E
the unlinked element e)Links the element to the front of the deque so that it becomes the first element. |
| pack-priv void | linkLast(final E
the unlinked element e)Links the element to the back of the deque so that it becomes the last element. |
| public void | moveToBack(E
the linked element e)Implements com. |
| public void | moveToFront(E
the linked element e)Implements com. |
| public boolean | offer(E
the element to add e)Implements java. true upon success and false if no space is currently
available.
|
| public boolean | offerFirst(E
the element to add e)Implements java. |
| public boolean | offerLast(E
the element to add e)Implements java. |
| public @Nullable E | peek()
Implements java. null if this deque is empty.
|
| public @Nullable E | peekFirst()
Implements java. null if this deque is empty.
|
| public @Nullable E | peekLast()
Implements java. null if this deque is empty.
|
| public @Nullable E | poll()
Implements java. null if this deque is empty.
|
| public @Nullable E | pollFirst()
Implements java. null if this deque is empty.
|
| public @Nullable E | pollLast()
Implements java. null if this deque is empty.
|
| public E | |
| public void | push(E
the element to push e)Implements java. IllegalStateException if no space is currently available.
|
| public E | remove()
Implements java. |
| public abstract boolean | remove(Object
element to be removed from this deque, if present o)Redeclares java. Overrides java. |
| public boolean | removeAll(Collection<?>
collection containing elements to be removed from this collection c)Overrides java. Implements java. |
| public E | removeFirst()
Implements java. |
| public boolean | removeFirstOccurrence(Object
element to be removed from this deque, if present o)Implements java. |
| public E | removeLast()
Implements java. |
| public boolean | removeLastOccurrence(Object
element to be removed from this deque, if present o)Implements java. |
| public int | size()
Implements abstract java. Implements java. |
| pack-priv void | |
| pack-priv E | |
| pack-priv E |
| first | back to summary |
|---|---|
| pack-priv @Nullable E first Pointer to first node. Invariant: (first == null && last == null) || (first.prev == null) | |
| last | back to summary |
|---|---|
| pack-priv @Nullable E last Pointer to last node. Invariant: (first == null && last == null) || (last.next == null) | |
| modCount | back to summary |
|---|---|
| pack-priv int modCount The number of times this deque has been structurally modified. Structural modifications are those that change the size of the deque, or otherwise perturb it in such a fashion that iterations in progress may yield incorrect results. | |
| AbstractLinkedDeque | back to summary |
|---|---|
| pack-priv AbstractLinkedDeque() | |
| add | back to summary |
|---|---|
| public boolean add(E e) Overrides java. Implements java. Doc from java. 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
This method is equivalent to
| |
| addFirst | back to summary |
|---|---|
| public void addFirst(E e) Implements java. Doc from java. Inserts the specified element at the front of this deque if it is
possible to do so immediately without violating capacity restrictions,
throwing an
| |
| addLast | back to summary |
|---|---|
| public void addLast(E e) Implements java. Doc from java. Inserts the specified element at the end of this deque if it is
possible to do so immediately without violating capacity restrictions,
throwing an This method is equivalent to
| |
| checkNotEmpty | back to summary |
|---|---|
| pack-priv void checkNotEmpty() | |
| clear | back to summary |
|---|---|
| public void clear() Overrides java. Implements java. Doc from java. Removes all of the elements from this collection (optional operation). The collection will be empty after this method returns.
| |
| contains | back to summary |
|---|---|
| public abstract boolean contains(Object o) Redeclares java. Overrides java. Doc from java. Returns | |
| descendingIterator | back to summary |
|---|---|
| public LinkedDeque. Implements com. Doc from java. Returns an iterator over the elements in this deque in reverse sequential order. The elements will be returned in order from last (tail) to first (head).
| |
| element | back to summary |
|---|---|
| public E element() Implements java. Doc from java. 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 This method is equivalent to
| |
| getFirst | back to summary |
|---|---|
| public E getFirst() Implements java. Doc from java. Retrieves, but does not remove, the first element of this deque.
This method differs from
| |
| getLast | back to summary |
|---|---|
| public E getLast() Implements java. Doc from java. Retrieves, but does not remove, the last element of this deque.
This method differs from
| |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() Overrides java. Implements java. Doc from java. Returns
| |
| isFirst | back to summary |
|---|---|
| public boolean isFirst(E e) Implements com. Doc from com. Returns if the element is at the front of the deque.
| |
| isLast | back to summary |
|---|---|
| public boolean isLast(E e) Implements com. Doc from com. Returns if the element is at the back of the deque.
| |
| iterator | back to summary |
|---|---|
| public LinkedDeque. Implements abstract java. Implements com. Doc from java. 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).
| |
| linkFirst | back to summary |
|---|---|
| pack-priv void linkFirst(final E e) Links the element to the front of the deque so that it becomes the first element.
| |
| linkLast | back to summary |
|---|---|
| pack-priv void linkLast(final E e) Links the element to the back of the deque so that it becomes the last element.
| |
| moveToBack | back to summary |
|---|---|
| public void moveToBack(E e) Implements com. Doc from com. Moves the element to the back of the deque so that it becomes the last element.
| |
| moveToFront | back to summary |
|---|---|
| public void moveToFront(E e) Implements com. Doc from com. Moves the element to the front of the deque so that it becomes the first element.
| |
| offer | back to summary |
|---|---|
| public boolean offer(E e) Implements java. Doc from java. 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
This method is equivalent to
| |
| offerFirst | back to summary |
|---|---|
| public boolean offerFirst(E e) Implements java. Doc from java. Inserts the specified element at the front of this deque unless it would
violate capacity restrictions. When using a capacity-restricted deque,
this method is generally preferable to the
| |
| offerLast | back to summary |
|---|---|
| public boolean offerLast(E e) Implements java. Doc from java. Inserts the specified element at the end of this deque unless it would
violate capacity restrictions. When using a capacity-restricted deque,
this method is generally preferable to the
| |
| peek | back to summary |
|---|---|
| public @Nullable E peek() Implements java. Doc from java. 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 This method is equivalent to | |
| peekFirst | back to summary |
|---|---|
| public @Nullable E peekFirst() Implements java. Doc from java. Retrieves, but does not remove, the first element of this deque,
or returns | |
| peekLast | back to summary |
|---|---|
| public @Nullable E peekLast() Implements java. Doc from java. Retrieves, but does not remove, the last element of this deque,
or returns | |
| poll | back to summary |
|---|---|
| public @Nullable E poll() Implements java. Doc from java. Retrieves and removes the head of the queue represented by this deque
(in other words, the first element of this deque), or returns
This method is equivalent to | |
| pollFirst | back to summary |
|---|---|
| public @Nullable E pollFirst() Implements java. Doc from java. Retrieves and removes the first element of this deque,
or returns | |
| pollLast | back to summary |
|---|---|
| public @Nullable E pollLast() Implements java. Doc from java. Retrieves and removes the last element of this deque,
or returns | |
| pop | back to summary |
|---|---|
| public E pop() Implements java. Doc from java. Pops an element from the stack represented by this deque. In other words, removes and returns the first element of this deque. This method is equivalent to
| |
| push | back to summary |
|---|---|
| public void push(E e) Implements java. Doc from java. 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
This method is equivalent to
| |
| remove | back to summary |
|---|---|
| public E remove() Implements java. Doc from java. 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 This method is equivalent to
| |
| remove | back to summary |
|---|---|
| public abstract boolean remove(Object o) Redeclares java. Overrides java. Doc from java. 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 This method is equivalent to | |
| removeAll | back to summary |
|---|---|
| public boolean removeAll(Collection<?> c) Overrides java. Implements java. Doc from java. Removes all of this collection's elements that are also contained in the specified collection (optional operation). After this call returns, this collection will contain no elements in common with the specified collection.
| |
| removeFirst | back to summary |
|---|---|
| public E removeFirst() Implements java. Doc from java. Retrieves and removes the first element of this deque. This method
differs from
| |
| removeFirstOccurrence | back to summary |
|---|---|
| public boolean removeFirstOccurrence(Object o) Implements java. Doc from java. 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 | |
| removeLast | back to summary |
|---|---|
| public E removeLast() Implements java. Doc from java. Retrieves and removes the last element of this deque. This method
differs from
| |
| removeLastOccurrence | back to summary |
|---|---|
| public boolean removeLastOccurrence(Object o) Implements java. Doc from java. 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 | |
| size | back to summary |
|---|---|
| public int size() Implements abstract java. Implements java. Doc from java. Returns the number of elements in this deque. Beware that, unlike in most collections, this method is NOT a constant-time operation.
| |
| unlink | back to summary |
|---|---|
| pack-priv void unlink(E e) Unlinks the non-null element. | |
| unlinkFirst | back to summary |
|---|---|
| pack-priv E unlinkFirst() Unlinks the non-null first element.
| |
| unlinkLast | back to summary |
|---|---|
| pack-priv E unlinkLast() Unlinks the non-null last element.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv @Nullable E | |
| pack-priv int | |
| pack-priv @Nullable E |
| Access | Constructor and Description |
|---|---|
| pack-priv | AbstractLinkedIterator(@Nullable E
the initial element to begin traversal from start)Creates an iterator that can can traverse the deque. |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | checkForComodification()
If the expected modCount value that the iterator believes that the backing deque should have is violated then the iterator has detected concurrent modification. |
| pack-priv abstract @Nullable E | |
| public boolean | |
| public E | |
| public @Nullable E | peek()
Implements com. |
| public void | remove()
Overrides default java. |
| cursor | back to summary |
|---|---|
| pack-priv @Nullable E cursor | |
| expectedModCount | back to summary |
|---|---|
| pack-priv int expectedModCount | |
| previous | back to summary |
|---|---|
| pack-priv @Nullable E previous | |
| AbstractLinkedIterator | back to summary |
|---|---|
| pack-priv AbstractLinkedIterator(@Nullable E start) Creates an iterator that can can traverse the deque.
| |
| checkForComodification | back to summary |
|---|---|
| pack-priv void checkForComodification() If the expected modCount value that the iterator believes that the backing deque should have is violated then the iterator has detected concurrent modification. | |
| computeNext | back to summary |
|---|---|
| pack-priv abstract @Nullable E computeNext() Retrieves the next element to traverse to or null if there are no more elements. | |
| hasNext | back to summary |
|---|---|
| public boolean hasNext() Implements java. Doc from java. Returns
| |
| next | back to summary |
|---|---|
| public E next() Implements java. Doc from java. Returns the next element in the iteration.
| |
| peek | back to summary |
|---|---|
| public @Nullable E peek() Implements com. Doc from com. Returns the next element in the iteration, without advancing the iteration.
| |
| remove | back to summary |
|---|---|
| public void remove() Overrides default java. Doc from java. Removes from the underlying collection the last element returned
by this iterator (optional operation). This method can be called
only once per call to The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.
The behavior of an iterator is unspecified if this method is called
after a call to the
| |