E - The element typepublic class BlockingArrayQueue<E> extends AbstractList<E> implements BlockingQueue<E>
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.| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_CAPACITY
Default initial capacity, 128.
|
static int |
DEFAULT_GROWTH
Default growth factor, 64.
|
modCount| Constructor and Description |
|---|
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. |
| Modifier and Type | Method and Description |
|---|---|
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, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitcontainsaddAll, containsAll, equals, hashCode, isEmpty, removeAll, retainAll, 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 in interface Collection<E>clear in interface List<E>clear in class AbstractList<E>public int size()
size in interface Collection<E>size in interface List<E>size in class AbstractCollection<E>public boolean offer(E e)
public boolean add(E e)
add in interface Collection<E>add in interface BlockingQueue<E>add in interface List<E>add in interface Queue<E>add in class AbstractList<E>public void put(E o) throws InterruptedException
put in interface BlockingQueue<E>InterruptedExceptionpublic boolean offer(E o, long timeout, TimeUnit unit) throws InterruptedException
offer in interface BlockingQueue<E>InterruptedExceptionpublic E take() throws InterruptedException
take in interface BlockingQueue<E>InterruptedExceptionpublic E poll(long time, TimeUnit unit) throws InterruptedException
poll in interface BlockingQueue<E>InterruptedExceptionpublic boolean remove(Object o)
remove in interface Collection<E>remove in interface BlockingQueue<E>remove in interface List<E>remove in class AbstractCollection<E>public int remainingCapacity()
remainingCapacity in interface BlockingQueue<E>public int drainTo(Collection<? super E> c)
drainTo in interface BlockingQueue<E>public int drainTo(Collection<? super E> c, int maxElements)
drainTo in interface BlockingQueue<E>public E get(int index)
public void add(int index,
E e)
public E remove(int index)
public ListIterator<E> listIterator(int index)
listIterator in interface List<E>listIterator in class AbstractList<E>public int getCapacity()
public int getMaxCapacity()
Copyright © 1995-2015 Webtide. All Rights Reserved.