E
- public class ArrayQueue<E>
extends java.util.AbstractList<E>
implements java.util.Queue<E>
#pop()
for stack operation)
is backed by a growable circular array.Modifier and Type | Field and Description |
---|---|
protected java.lang.Object[] |
_elements |
protected int |
_growCapacity |
protected java.lang.Object |
_lock |
protected int |
_nextE |
protected int |
_nextSlot |
protected int |
_size |
int |
DEFAULT_CAPACITY |
int |
DEFAULT_GROWTH |
Constructor and Description |
---|
ArrayQueue() |
ArrayQueue(int capacity) |
ArrayQueue(int initCapacity,
int growBy) |
ArrayQueue(int initCapacity,
int growBy,
java.lang.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, subList
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
public final int DEFAULT_CAPACITY
public final int DEFAULT_GROWTH
protected java.lang.Object _lock
protected java.lang.Object[] _elements
protected int _nextE
protected int _nextSlot
protected int _size
protected int _growCapacity
public ArrayQueue()
public ArrayQueue(int capacity)
public ArrayQueue(int initCapacity, int growBy)
public ArrayQueue(int initCapacity, int growBy, java.lang.Object lock)
public int getCapacity()
public boolean add(E e)
public void addUnsafe(E e)
add(Object)
public void clear()
public boolean isEmpty()
public int size()
public E get(int index)
public E getUnsafe(int index)
get(int)
public E remove(int index)
public void add(int index, E element)
protected boolean grow()
Copyright © 2009 Mortbay Consulting Pty. Ltd. All Rights Reserved.