Deque interface where the link pointers are tightly
integrated with the element. Linked deques have no capacity restrictions; they grow as necessary
to support usage. They are not thread-safe; in the absence of external synchronization, they do
not support concurrent access by multiple threads. Null elements are prohibited.
Most LinkedDeque operations run in constant time by assuming that the element parameter is associated with the deque instance. Any usage that violates this assumption will result in non-deterministic behavior.
An element can exist in only one instance of a deque implementation, but may exist in multiple implementations. Each implementation must define unique names for accessing and modifying its link pointers.
The iterators returned by this class are fail-fast: If the deque is structurally modified
at any time after the iterator is created, in any way except through the iterator's own
remove method, then the iterator will throw a
ConcurrentModificationException. Thus, in the face of concurrent modification, the
iterator fails quickly and cleanly, rather than risking arbitrary, non-deterministic behavior at
an undetermined time in the future. Note that the fail-fast behavior of an iterator cannot be
guaranteed and should be used only to detect bugs.
| Modifier and Type | Class and Description |
|---|---|
| public static interface |
| Modifier and Type | Method and Description |
|---|---|
| public LinkedDeque. | descendingIterator()
Redeclares java. |
| public @Nullable E | getNext(E e)
Retrieves the next element or null if either the element is unlinked or the last element on the deque. |
| public @Nullable E | getPrevious(E e)
Retrieves the previous element or null if either the element is unlinked or the first element on the deque. |
| public boolean | |
| public boolean | |
| public LinkedDeque. | iterator()
Redeclares java. |
| public void | moveToBack(E
the linked element e)Moves the element to the back of the deque so that it becomes the last element. |
| public void | moveToFront(E
the linked element e)Moves the element to the front of the deque so that it becomes the first element. |
| public void | |
| public void |
| descendingIterator | back to summary |
|---|---|
| public LinkedDeque. Redeclares java. 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).
| |
| getNext | back to summary |
|---|---|
| public @Nullable E getNext(E e) Retrieves the next element or null if either the element is unlinked or the last element on the deque. | |
| getPrevious | back to summary |
|---|---|
| public @Nullable E getPrevious(E e) Retrieves the previous element or null if either the element is unlinked or the first element on the deque. | |
| isFirst | back to summary |
|---|---|
| public boolean isFirst(E e) Returns if the element is at the front of the deque.
| |
| isLast | back to summary |
|---|---|
| public boolean isLast(E e) Returns if the element is at the back of the deque.
| |
| iterator | back to summary |
|---|---|
| public LinkedDeque. Redeclares java. 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).
| |
| moveToBack | back to summary |
|---|---|
| public void moveToBack(E e) 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) Moves the element to the front of the deque so that it becomes the first element.
| |
| setNext | back to summary |
|---|---|
| public void setNext(E e, @Nullable E next) Sets the next element or null if there is no link. | |
| setPrevious | back to summary |
|---|---|
| public void setPrevious(E e, @Nullable E prev) Sets the previous element or null if there is no link. | |
| Modifier and Type | Method and Description |
|---|---|
| public static <E> LinkedDeque. | comparing(LinkedDeque.
Returns an iterator that selects the greater element from the backing iterators. |
| public static <E> LinkedDeque. | concat(LinkedDeque.
Returns an iterator that returns the first iteration followed by the second iteration. |
| public @Nullable E |
| comparing | back to summary |
|---|---|
| public static <E> LinkedDeque. Returns an iterator that selects the greater element from the backing iterators. | |
| concat | back to summary |
|---|---|
| public static <E> LinkedDeque. Returns an iterator that returns the first iteration followed by the second iteration. | |
| peek | back to summary |
|---|---|
| public @Nullable E peek() Returns the next element in the iteration, without advancing the iteration. | |