Package dev.gmitch215.bytebox.util
Class LinkedBlockingQueue<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractQueue<E>
dev.gmitch215.bytebox.util.LinkedBlockingQueue<E>
- All Implemented Interfaces:
Iterable<E>,Collection<E>,BlockingQueue<E>,Queue<E>
An unbounded queue whose blocking calls never wait.
One fiber runs at a time and nothing can add to the queue while a caller sleeps on it, so a
wait that could be satisfied is a wait that never ends. take on an empty queue therefore
throws, and poll with a timeout answers at once.
- Since:
- 1.0.3
-
Constructor Summary
ConstructorsConstructorDescriptionLinkedBlockingQueue(int capacity) LinkedBlockingQueue(Collection<? extends E> initial) -
Method Summary
Methods inherited from class java.util.AbstractCollection
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.concurrent.BlockingQueue
add, contains, removeMethods inherited from interface java.util.Collection
addAll, clear, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArray
-
Constructor Details
-
LinkedBlockingQueue
public LinkedBlockingQueue() -
LinkedBlockingQueue
public LinkedBlockingQueue(int capacity) -
LinkedBlockingQueue
-
-
Method Details
-
offer
-
put
- Specified by:
putin interfaceBlockingQueue<E>
-
offer
- Specified by:
offerin interfaceBlockingQueue<E>
-
poll
-
take
- Specified by:
takein interfaceBlockingQueue<E>
-
poll
- Specified by:
pollin interfaceBlockingQueue<E>
-
peek
-
remainingCapacity
public int remainingCapacity()- Specified by:
remainingCapacityin interfaceBlockingQueue<E>
-
drainTo
- Specified by:
drainToin interfaceBlockingQueue<E>
-
drainTo
- Specified by:
drainToin interfaceBlockingQueue<E>
-
size
public int size()- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein classAbstractCollection<E>
-
iterator
- Specified by:
iteratorin interfaceCollection<E>- Specified by:
iteratorin interfaceIterable<E>- Specified by:
iteratorin classAbstractCollection<E>
-