E - public class ArrayQueue<E> extends AbstractList<E> implements Queue<E>
remove() for stack operation)
is backed by a growable circular array.| Modifier and Type | Field and Description |
|---|---|
protected Object[] |
_elements |
protected int |
_growCapacity |
protected Object |
_lock |
protected int |
_nextE |
protected int |
_nextSlot |
protected int |
_size |
static int |
DEFAULT_CAPACITY |
static int |
DEFAULT_GROWTH |
modCount| Constructor and Description |
|---|
ArrayQueue() |
ArrayQueue(int capacity) |
ArrayQueue(int initCapacity,
int growBy) |
ArrayQueue(int initCapacity,
int growBy,
Object lock) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E e) |
void |
add(int index,
E element) |
void |
addUnsafe(E e)
Add without synchronization or bounds checking
|
void |
clear() |
E |
element() |
E |
get(int index) |
int |
getCapacity() |
E |
getUnsafe(int index)
Get without synchronization or bounds checking.
|
protected boolean |
grow() |
boolean |
isEmpty() |
boolean |
offer(E e) |
E |
peek() |
E |
poll() |
E |
remove() |
E |
remove(int index) |
E |
set(int index,
E element) |
int |
size() |
addAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subListaddAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic static final int DEFAULT_CAPACITY
public static final int DEFAULT_GROWTH
protected final Object _lock
protected final int _growCapacity
protected Object[] _elements
protected int _nextE
protected int _nextSlot
protected int _size
public ArrayQueue()
public ArrayQueue(int capacity)
public ArrayQueue(int initCapacity,
int growBy)
public ArrayQueue(int initCapacity,
int growBy,
Object lock)
public int getCapacity()
public boolean add(E e)
public void addUnsafe(E e)
e - the element to addadd(Object)public void clear()
clear in interface Collection<E>clear in interface List<E>clear in class AbstractList<E>public boolean isEmpty()
isEmpty in interface Collection<E>isEmpty in interface List<E>isEmpty in class AbstractCollection<E>public int size()
size in interface Collection<E>size in interface List<E>size in class AbstractCollection<E>public E get(int index)
public E getUnsafe(int index)
index - index of the element to returnget(int)public E remove(int index)
public void add(int index,
E element)
protected boolean grow()
Copyright © 1995-2015 Mort Bay Consulting. All Rights Reserved.