E - the type of object the queue holdspublic class ArrayQueue<E> extends AbstractList<E> implements Queue<E>
This partial Queue implementation (also with remove() for stack
operation) is backed by a growable circular array.
| 限定符和类型 | 字段和说明 |
|---|---|
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| 构造器和说明 |
|---|
ArrayQueue() |
ArrayQueue(int capacity) |
ArrayQueue(int initCapacity,
int growBy) |
ArrayQueue(int initCapacity,
int growBy,
Object lock) |
ArrayQueue(Object lock) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
add(E e) |
void |
add(int index,
E element) |
void |
addUnsafe(E e)
Add without synchronization or bounds checking
|
void |
clear() |
protected E |
dequeue() |
E |
element() |
protected boolean |
enqueue(E e) |
E |
get(int index) |
int |
getCapacity() |
int |
getNextSlotUnsafe() |
E |
getUnsafe(int index)
Get without synchronization or bounds checking.
|
protected boolean |
growUnsafe() |
boolean |
isEmpty() |
Object |
lock() |
boolean |
offer(E e) |
E |
peek() |
E |
peekUnsafe() |
E |
poll() |
E |
pollUnsafe() |
E |
remove() |
E |
remove(int index) |
protected void |
resizeUnsafe(int newCapacity) |
E |
set(int index,
E element) |
int |
size() |
int |
sizeUnsafe() |
addAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subListaddAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray, toStringaddAll, contains, containsAll, equals, hashCode, iterator, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArrayaddAll, contains, containsAll, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArraypublic 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(Object lock)
public ArrayQueue(int capacity)
public ArrayQueue(int initCapacity,
int growBy)
public ArrayQueue(int initCapacity,
int growBy,
Object lock)
public Object lock()
public int getCapacity()
public int getNextSlotUnsafe()
public boolean add(E e)
protected boolean enqueue(E e)
public void addUnsafe(E e)
e - the element to addadd(Object)public E peekUnsafe()
public E pollUnsafe()
protected E dequeue()
public void clear()
clear 在接口中 Collection<E>clear 在接口中 List<E>clear 在类中 AbstractList<E>public boolean isEmpty()
isEmpty 在接口中 Collection<E>isEmpty 在接口中 List<E>isEmpty 在类中 AbstractCollection<E>public int size()
size 在接口中 Collection<E>size 在接口中 List<E>size 在类中 AbstractCollection<E>public int sizeUnsafe()
public E getUnsafe(int index)
index - index of the element to returnget(int)protected void resizeUnsafe(int newCapacity)
protected boolean growUnsafe()
Copyright © 2016. All rights reserved.