E - The element typepublic class BlockingArrayQueue<E> extends AbstractList<E> implements BlockingQueue<E>
This queue is uses a variant of the two lock queue algorithm to provide an efficient queue or list backed by a growable circular array.
Unlike ArrayBlockingQueue, this class is able to
grow and provides a blocking put call.
The queue has both a capacity (the size of the array currently allocated) and
a max capacity (the maximum size that may be allocated), which defaults to
Integer.MAX_VALUE.
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
DEFAULT_CAPACITY
Default initial capacity, 128.
|
static int |
DEFAULT_GROWTH
Default growth factor, 64.
|
modCount| 构造器和说明 |
|---|
BlockingArrayQueue()
Creates an unbounded
BlockingArrayQueue with default initial
capacity and grow factor. |
BlockingArrayQueue(int maxCapacity)
Creates a bounded
BlockingArrayQueue that does not grow. |
BlockingArrayQueue(int capacity,
int growBy)
Creates an unbounded
BlockingArrayQueue that grows by the given
parameter. |
BlockingArrayQueue(int capacity,
int growBy,
int maxCapacity)
Create a bounded
BlockingArrayQueue that grows by the given
parameter. |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
add(E e) |
void |
add(int index,
E e) |
void |
clear() |
int |
drainTo(Collection<? super E> c) |
int |
drainTo(Collection<? super E> c,
int maxElements) |
E |
element() |
E |
get(int index) |
int |
getCapacity() |
int |
getMaxCapacity() |
Iterator<E> |
iterator() |
ListIterator<E> |
listIterator(int index) |
boolean |
offer(E e) |
boolean |
offer(E o,
long timeout,
TimeUnit unit) |
E |
peek() |
E |
poll() |
E |
poll(long time,
TimeUnit unit) |
void |
put(E o) |
int |
remainingCapacity() |
E |
remove() |
E |
remove(int index) |
boolean |
remove(Object o) |
E |
set(int index,
E e) |
int |
size() |
E |
take() |
addAll, equals, hashCode, indexOf, lastIndexOf, listIterator, removeRange, subListaddAll, contains, containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toStringcontainsaddAll, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArrayaddAll, contains, containsAll, isEmpty, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArraypublic static final int DEFAULT_CAPACITY
public static final int DEFAULT_GROWTH
public BlockingArrayQueue()
BlockingArrayQueue with default initial
capacity and grow factor.DEFAULT_CAPACITY,
DEFAULT_GROWTHpublic BlockingArrayQueue(int maxCapacity)
BlockingArrayQueue that does not grow. The
capacity of the queue is fixed and equal to the given parameter.maxCapacity - the maximum capacitypublic BlockingArrayQueue(int capacity,
int growBy)
BlockingArrayQueue that grows by the given
parameter.capacity - the initial capacitygrowBy - the growth factorpublic BlockingArrayQueue(int capacity,
int growBy,
int maxCapacity)
BlockingArrayQueue that grows by the given
parameter.capacity - the initial capacitygrowBy - the growth factormaxCapacity - the maximum capacitypublic void clear()
clear 在接口中 Collection<E>clear 在接口中 List<E>clear 在类中 AbstractList<E>public int size()
size 在接口中 Collection<E>size 在接口中 List<E>size 在类中 AbstractCollection<E>public boolean add(E e)
add 在接口中 Collection<E>add 在接口中 BlockingQueue<E>add 在接口中 List<E>add 在接口中 Queue<E>add 在类中 AbstractList<E>public void put(E o) throws InterruptedException
put 在接口中 BlockingQueue<E>InterruptedExceptionpublic boolean offer(E o, long timeout, TimeUnit unit) throws InterruptedException
offer 在接口中 BlockingQueue<E>InterruptedExceptionpublic E take() throws InterruptedException
take 在接口中 BlockingQueue<E>InterruptedExceptionpublic E poll(long time, TimeUnit unit) throws InterruptedException
poll 在接口中 BlockingQueue<E>InterruptedExceptionpublic boolean remove(Object o)
remove 在接口中 Collection<E>remove 在接口中 BlockingQueue<E>remove 在接口中 List<E>remove 在类中 AbstractCollection<E>public int remainingCapacity()
remainingCapacity 在接口中 BlockingQueue<E>public int drainTo(Collection<? super E> c)
drainTo 在接口中 BlockingQueue<E>public int drainTo(Collection<? super E> c, int maxElements)
drainTo 在接口中 BlockingQueue<E>public ListIterator<E> listIterator(int index)
listIterator 在接口中 List<E>listIterator 在类中 AbstractList<E>public int getCapacity()
public int getMaxCapacity()
Copyright © 2016. All rights reserved.