Queue and Deque instances. Also see this
class's counterparts Lists, Sets, and Maps.
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static <E> int | Returns: the number of elements transferredthe blocking queue to be drained q, Collection<? super E> where to add the transferred elements buffer, int the number of elements to be waited for numElements, Duration how long to wait before giving up timeout)Drains the queue as |
| public static <E> int | Returns: the number of elements transferredthe blocking queue to be drained q, Collection<? super E> where to add the transferred elements buffer, int the number of elements to be waited for numElements, long how long to wait before giving up, in units of timeout, TimeUnit unita unit)TimeUnit determining how to interpret the timeout parameterDrains the queue as |
| public static <E> int | Returns: the number of elements transferredthe blocking queue to be drained q, Collection<? super E> where to add the transferred elements buffer, int the number of elements to be waited for numElements, Duration how long to wait before giving up timeout)Drains the queue as drain(BlockingQueue, Collection, int, Duration), but with a different behavior in case it is interrupted while waiting. |
| public static <E> int | Returns: the number of elements transferredthe blocking queue to be drained q, Collection<? super E> where to add the transferred elements buffer, int the number of elements to be waited for numElements, long how long to wait before giving up, in units of timeout, TimeUnit unita unit)TimeUnit determining how to interpret the timeout parameterDrains the queue as drain(BlockingQueue, Collection, int, long, TimeUnit), but with a different behavior in case it is interrupted while waiting. |
| public static <E> ArrayBlockingQueue | newArrayBlockingQueue(int capacity)
Creates an empty |
| public static <E> ArrayDeque | |
| public static <E> ArrayDeque | newArrayDeque(Iterable<? extends E> elements)
Creates an |
| public static <E> ConcurrentLinkedQueue | |
| public static <E> ConcurrentLinkedQueue | newConcurrentLinkedQueue(Iterable<? extends E> elements)
Creates a |
| public static <E> LinkedBlockingDeque | |
| public static <E> LinkedBlockingDeque | newLinkedBlockingDeque(int capacity)
Creates an empty |
| public static <E> LinkedBlockingDeque | newLinkedBlockingDeque(Iterable<? extends E> elements)
Creates a |
| public static <E> LinkedBlockingQueue | |
| public static <E> LinkedBlockingQueue | newLinkedBlockingQueue(int capacity)
Creates an empty |
| public static <E> LinkedBlockingQueue | Returns: a newLinkedBlockingQueue containing those elementsthe elements that the queue should contain, in order elements)Creates a |
| public static <E extends Comparable | newPriorityBlockingQueue()
Creates an empty |
| public static <E extends Comparable | newPriorityBlockingQueue(Iterable<? extends E> elements)
Creates a |
| public static <E extends Comparable | newPriorityQueue()
Creates an empty |
| public static <E extends Comparable | newPriorityQueue(Iterable<? extends E> elements)
Creates a |
| public static <E> SynchronousQueue | |
| public static <E extends @Nullable Object> Deque | Returns: a synchronized view of the specified dequethe deque to be wrapped in a synchronized view deque)Returns a synchronized (thread-safe) deque backed by the specified deque. |
| public static <E extends @Nullable Object> Queue | Returns: a synchronized view of the specified queuethe queue to be wrapped in a synchronized view queue)Returns a synchronized (thread-safe) queue backed by the specified queue. |
| Queues | back to summary |
|---|---|
| private Queues() | |
| drain | back to summary |
|---|---|
| public static <E> int drain(BlockingQueue<E> q, Collection<? super E> buffer, int numElements, Duration timeout) throws InterruptedException Drains the queue as
| |
| drain | back to summary |
|---|---|
| public static <E> int drain(BlockingQueue<E> q, Collection<? super E> buffer, int numElements, long timeout, TimeUnit unit) throws InterruptedException Drains the queue as
| |
| drainUninterruptibly | back to summary |
|---|---|
| public static <E> int drainUninterruptibly(BlockingQueue<E> q, Collection<? super E> buffer, int numElements, Duration timeout) Drains the queue as drain(BlockingQueue, Collection, int, Duration), but with a
different behavior in case it is interrupted while waiting. In that case, the operation will
continue as usual, and in the end the thread's interruption status will be set (no
| |
| drainUninterruptibly | back to summary |
|---|---|
| public 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. In that case, the operation
will continue as usual, and in the end the thread's interruption status will be set (no
| |
| newArrayBlockingQueue | back to summary |
|---|---|
| public static <E> ArrayBlockingQueue Creates an empty
| |
| newArrayDeque | back to summary |
|---|---|
| public static <E> ArrayDeque Creates an empty
| |
| newArrayDeque | back to summary |
|---|---|
| public static <E> ArrayDeque Creates an
| |
| newConcurrentLinkedQueue | back to summary |
|---|---|
| public static <E> ConcurrentLinkedQueue Creates an empty
| |
| newConcurrentLinkedQueue | back to summary |
|---|---|
| public static <E> ConcurrentLinkedQueue Creates a
| |
| newLinkedBlockingDeque | back to summary |
|---|---|
| public static <E> LinkedBlockingDeque Creates an empty
| |
| newLinkedBlockingDeque | back to summary |
|---|---|
| public static <E> LinkedBlockingDeque Creates an empty
| |
| newLinkedBlockingDeque | back to summary |
|---|---|
| public static <E> LinkedBlockingDeque Creates a
| |
| newLinkedBlockingQueue | back to summary |
|---|---|
| public static <E> LinkedBlockingQueue Creates an empty
| |
| newLinkedBlockingQueue | back to summary |
|---|---|
| public static <E> LinkedBlockingQueue Creates an empty
| |
| newLinkedBlockingQueue | back to summary |
|---|---|
| public static <E> LinkedBlockingQueue Creates a
| |
| newPriorityBlockingQueue | back to summary |
|---|---|
| public static <E extends Comparable Creates an empty
| |
| newPriorityBlockingQueue | back to summary |
|---|---|
| public static <E extends Comparable Creates a Note If the specified iterable is a
| |
| newPriorityQueue | back to summary |
|---|---|
| public static <E extends Comparable Creates an empty
| |
| newPriorityQueue | back to summary |
|---|---|
| public static <E extends Comparable Creates a Note If the specified iterable is a
| |
| newSynchronousQueue | back to summary |
|---|---|
| public static <E> SynchronousQueue Creates an empty
| |
| synchronizedDeque | back to summary |
|---|---|
| public static <E extends @Nullable Object> Deque Returns a synchronized (thread-safe) deque backed by the specified deque. In order to guarantee serial access, it is critical that all access to the backing deque is accomplished through the returned deque. It is imperative that the user manually synchronize on the returned deque when accessing any of the deque's iterators:
Failure to follow this advice may result in non-deterministic behavior. The returned deque will be serializable if the specified deque is serializable. | |
| synchronizedQueue | back to summary |
|---|---|
| public static <E extends @Nullable Object> Queue Returns a synchronized (thread-safe) queue backed by the specified queue. In order to guarantee serial access, it is critical that all access to the backing queue is accomplished through the returned queue. It is imperative that the user manually synchronize on the returned queue when accessing the queue's iterator:
Failure to follow this advice may result in non-deterministic behavior. The returned queue will be serializable if the specified queue is serializable. | |