| Modifier and Type | Method and Description |
|---|---|
static <E> int |
drain(BlockingQueue<E> q,
Collection<? super E> buffer,
int numElements,
long timeout,
TimeUnit unit)
Drains the queue as
BlockingQueue.drainTo(Collection, int), but if the requested
numElements elements are not available, it will wait for them up to the specified
timeout. |
static <E> int |
drainUninterruptibly(BlockingQueue<E> q,
Collection<? super E> buffer,
int numElements,
long timeout,
TimeUnit unit)
Drains the queue as drain(BlockingQueue, Collection, int, long, TimeUnit),
but with a different behavior in case it is interrupted while waiting.
|
static <E> ArrayBlockingQueue<E> |
newArrayBlockingQueue(int capacity)
Creates an empty
ArrayBlockingQueue instance. |
static <E> ArrayDeque<E> |
newArrayDeque()
Creates an empty
ArrayDeque instance. |
static <E> ArrayDeque<E> |
newArrayDeque(Iterable<? extends E> elements)
Creates an
ArrayDeque instance containing the given elements. |
static <E> ConcurrentLinkedQueue<E> |
newConcurrentLinkedQueue()
Creates an empty
ConcurrentLinkedQueue instance. |
static <E> ConcurrentLinkedQueue<E> |
newConcurrentLinkedQueue(Iterable<? extends E> elements)
Creates an
ConcurrentLinkedQueue instance containing the given elements. |
static <E> LinkedBlockingDeque<E> |
newLinkedBlockingDeque()
Creates an empty
LinkedBlockingDeque instance. |
static <E> LinkedBlockingDeque<E> |
newLinkedBlockingDeque(int capacity)
Creates a
LinkedBlockingDeque with the given (fixed) capacity. |
static <E> LinkedBlockingDeque<E> |
newLinkedBlockingDeque(Iterable<? extends E> elements)
Creates an
LinkedBlockingDeque instance containing the given elements. |
static <E> LinkedBlockingQueue<E> |
newLinkedBlockingQueue()
Creates an empty
LinkedBlockingQueue instance. |
static <E> LinkedBlockingQueue<E> |
newLinkedBlockingQueue(int capacity)
Creates a
LinkedBlockingQueue with the given (fixed) capacity. |
static <E> LinkedBlockingQueue<E> |
newLinkedBlockingQueue(Iterable<? extends E> elements)
Creates an
LinkedBlockingQueue instance containing the given elements. |
static <E> PriorityBlockingQueue<E> |
newPriorityBlockingQueue()
Creates an empty
PriorityBlockingQueue instance. |
static <E> PriorityBlockingQueue<E> |
newPriorityBlockingQueue(Iterable<? extends E> elements)
Creates an
PriorityBlockingQueue instance containing the given elements. |
static <E> PriorityQueue<E> |
newPriorityQueue()
Creates an empty
PriorityQueue instance. |
static <E> PriorityQueue<E> |
newPriorityQueue(Iterable<? extends E> elements)
Creates an
PriorityQueue instance containing the given elements. |
static <E> SynchronousQueue<E> |
newSynchronousQueue()
Creates an empty
SynchronousQueue instance. |
public static <E> ArrayBlockingQueue<E> newArrayBlockingQueue(int capacity)
ArrayBlockingQueue instance.ArrayBlockingQueuepublic static <E> ArrayDeque<E> newArrayDeque()
ArrayDeque instance.ArrayDequepublic static <E> ArrayDeque<E> newArrayDeque(Iterable<? extends E> elements)
ArrayDeque instance containing the given elements.elements - the elements that the queue should contain, in orderArrayDeque containing those elementspublic static <E> ConcurrentLinkedQueue<E> newConcurrentLinkedQueue()
ConcurrentLinkedQueue instance.ConcurrentLinkedQueuepublic static <E> ConcurrentLinkedQueue<E> newConcurrentLinkedQueue(Iterable<? extends E> elements)
ConcurrentLinkedQueue instance containing the given elements.elements - the elements that the queue should contain, in orderConcurrentLinkedQueue containing those elementspublic static <E> LinkedBlockingDeque<E> newLinkedBlockingDeque()
LinkedBlockingDeque instance.LinkedBlockingDequepublic static <E> LinkedBlockingDeque<E> newLinkedBlockingDeque(int capacity)
LinkedBlockingDeque with the given (fixed) capacity.capacity - the capacity of this dequeLinkedBlockingDequeIllegalArgumentException - if capacity is less than 1public static <E> LinkedBlockingDeque<E> newLinkedBlockingDeque(Iterable<? extends E> elements)
LinkedBlockingDeque instance containing the given elements.elements - the elements that the queue should contain, in orderLinkedBlockingDeque containing those elementspublic static <E> LinkedBlockingQueue<E> newLinkedBlockingQueue()
LinkedBlockingQueue instance.LinkedBlockingQueuepublic static <E> LinkedBlockingQueue<E> newLinkedBlockingQueue(int capacity)
LinkedBlockingQueue with the given (fixed) capacity.capacity - the capacity of this queueLinkedBlockingQueueIllegalArgumentException - if capacity is less than 1public static <E> LinkedBlockingQueue<E> newLinkedBlockingQueue(Iterable<? extends E> elements)
LinkedBlockingQueue instance containing the given elements.elements - the elements that the queue should contain, in orderLinkedBlockingQueue containing those elementspublic static <E> PriorityBlockingQueue<E> newPriorityBlockingQueue()
PriorityBlockingQueue instance.PriorityBlockingQueuepublic static <E> PriorityBlockingQueue<E> newPriorityBlockingQueue(Iterable<? extends E> elements)
PriorityBlockingQueue instance containing the given elements.elements - the elements that the queue should contain, in orderPriorityBlockingQueue containing those elementspublic static <E> PriorityQueue<E> newPriorityQueue()
PriorityQueue instance.PriorityQueuepublic static <E> PriorityQueue<E> newPriorityQueue(Iterable<? extends E> elements)
PriorityQueue instance containing the given elements.elements - the elements that the queue should contain, in orderPriorityQueue containing those elementspublic static <E> SynchronousQueue<E> newSynchronousQueue()
SynchronousQueue instance.SynchronousQueuepublic static <E> int drain(BlockingQueue<E> q, Collection<? super E> buffer, int numElements, long timeout, TimeUnit unit) throws InterruptedException
BlockingQueue.drainTo(Collection, int), but if the requested
numElements elements are not available, it will wait for them up to the specified
timeout.q - the blocking queue to be drainedbuffer - where to add the transferred elementsnumElements - the number of elements to be waited fortimeout - how long to wait before giving up, in units of unitunit - a TimeUnit determining how to interpret the timeout parameterInterruptedException - if interrupted while waitingpublic static <E> int drainUninterruptibly(BlockingQueue<E> q, Collection<? super E> buffer, int numElements, long timeout, TimeUnit unit)
InterruptedException is thrown).q - the blocking queue to be drainedbuffer - where to add the transferred elementsnumElements - the number of elements to be waited fortimeout - how long to wait before giving up, in units of unitunit - a TimeUnit determining how to interpret the timeout parameterCopyright © 2010-2013. All Rights Reserved.