E - the type of elements held in this collectionpublic class LinkedDeque<E extends Linked<E>> extends AbstractCollection<E> implements Deque<E>
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 Linked parameter is associated with the deque instance. Any usage
that violates this assumption will result in non-deterministic behavior.
The iterators returned by this class are not fail-fast: If the deque is modified at any time after the iterator is created, the iterator will be in an unknown state. Thus, in the face of concurrent modification, the iterator risks arbitrary, non-deterministic behavior at an undetermined time in the future.
| Constructor and Description |
|---|
LinkedDeque() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E e) |
void |
addFirst(E e) |
void |
addLast(E e) |
void |
clear() |
boolean |
contains(Object o) |
Iterator<E> |
descendingIterator() |
E |
element() |
E |
getFirst() |
E |
getLast() |
boolean |
isEmpty() |
Iterator<E> |
iterator() |
void |
moveToBack(E e)
Moves the element to the back of the deque so that it becomes the last
element.
|
void |
moveToFront(E e)
Moves the element to the front of the deque so that it becomes the first
element.
|
boolean |
offer(E e) |
boolean |
offerFirst(E e) |
boolean |
offerLast(E e) |
E |
peek() |
E |
peekFirst() |
E |
peekLast() |
E |
poll() |
E |
pollFirst() |
E |
pollLast() |
E |
pop() |
void |
push(E e) |
E |
remove() |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
E |
removeFirst() |
boolean |
removeFirstOccurrence(Object o) |
E |
removeLast() |
boolean |
removeLastOccurrence(Object o) |
int |
size()
Beware that, unlike in most collections, this method is NOT a
constant-time operation.
|
addAll, containsAll, retainAll, toArray, toArray, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddAll, containsAll, equals, hashCode, parallelStream, removeIf, retainAll, spliterator, stream, toArray, toArraypublic boolean isEmpty()
isEmpty in interface Collection<E extends Linked<E>>isEmpty in class AbstractCollection<E extends Linked<E>>public int size()
Beware that, unlike in most collections, this method is NOT a constant-time operation.
public void clear()
clear in interface Collection<E extends Linked<E>>clear in class AbstractCollection<E extends Linked<E>>public boolean contains(Object o)
public void moveToFront(E e)
e - the linked elementpublic void moveToBack(E e)
e - the linked elementpublic E peek()
public E element()
public boolean offer(E e)
public boolean offerFirst(E e)
offerFirst in interface Deque<E extends Linked<E>>public boolean offerLast(E e)
public boolean add(E e)
public E poll()
public E remove()
public boolean remove(Object o)
public E removeFirst()
removeFirst in interface Deque<E extends Linked<E>>public boolean removeFirstOccurrence(Object o)
removeFirstOccurrence in interface Deque<E extends Linked<E>>public boolean removeLastOccurrence(Object o)
removeLastOccurrence in interface Deque<E extends Linked<E>>public boolean removeAll(Collection<?> c)
removeAll in interface Collection<E extends Linked<E>>removeAll in class AbstractCollection<E extends Linked<E>>Copyright © 2025. All rights reserved.