E
- the element type.public class ArrayDeque<E> extends AbstractCollection<E> implements Deque<E>, Cloneable
Deque
based on circular buffer that is implemented with an array and head/tail
pointers. Array deques have no capacity restrictions; they grow as necessary to support usage.
Null elements are prohibited. This class is likely to be faster than Stack
when used as a stack, and faster than LinkedList
when used as a queue.
ArrayDequeConstructor and Description |
---|
ArrayDeque() |
ArrayDeque(Collection<? extends E> c) |
ArrayDeque(int numElements) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(E e) |
void |
addFirst(E e) |
void |
addLast(E e) |
void |
clear() |
Object |
clone() |
boolean |
contains(Object o) |
Iterator<E> |
descendingIterator() |
E |
element() |
E |
getFirst() |
E |
getLast() |
boolean |
isEmpty() |
Iterator<E> |
iterator() |
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) |
E |
removeFirst() |
boolean |
removeFirstOccurrence(Object o) |
E |
removeLast() |
boolean |
removeLastOccurrence(Object o) |
int |
size() |
Spliterator<E> |
spliterator() |
<T> T[] |
toArray(T[] out) |
addAll, containsAll, removeAll, retainAll, toArray, toString
addAll, containsAll, parallelStream, removeAll, removeIf, retainAll, stream, toArray
public ArrayDeque()
public ArrayDeque(Collection<? extends E> c)
public ArrayDeque(int numElements)
public boolean add(E e)
add
in interface Collection<E>
add
in class AbstractCollection<E>
public void clear()
clear
in interface Collection<E>
clear
in class AbstractCollection<E>
public Object clone()
public boolean contains(Object o)
contains
in interface Collection<E>
contains
in class AbstractCollection<E>
public Iterator<E> descendingIterator()
descendingIterator
in interface Deque<E>
public boolean isEmpty()
isEmpty
in interface Collection<E>
isEmpty
in class AbstractCollection<E>
public boolean offerFirst(E e)
offerFirst
in interface Deque<E>
public boolean remove(Object o)
remove
in interface Collection<E>
remove
in class AbstractCollection<E>
public E removeFirst()
removeFirst
in interface Deque<E>
public boolean removeFirstOccurrence(Object o)
removeFirstOccurrence
in interface Deque<E>
public E removeLast()
removeLast
in interface Deque<E>
public boolean removeLastOccurrence(Object o)
removeLastOccurrence
in interface Deque<E>
public int size()
size
in interface Collection<E>
public Spliterator<E> spliterator()
spliterator
in interface Iterable<E>
spliterator
in interface Collection<E>
public <T> T[] toArray(T[] out)
toArray
in interface Collection<E>
toArray
in class AbstractCollection<E>
Copyright © 2018. All rights reserved.