Package qilin.util.queue
Class QueueReader<E>
java.lang.Object
qilin.util.queue.QueueReader<E>
- All Implemented Interfaces:
Iterator<E>
A queue of Object's. One can add objects to the queue, and they are later read by a QueueReader.
One can create arbitrary numbers of QueueReader's for a queue, and each one receives all the
Object's that are added. Only objects that have not been read by all the QueueReader's are kept.
A QueueReader only receives the Object's added to the queue after the QueueReader was
created.
- Author:
- Ondrej Lhotak
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
boolean
hasNext()
Returns true iff there is currently another object in the queue.next()
Returns (and removes) the next object in the queue, or null if there are none.void
remove()
void
Removes an element from the underlying queue.void
remove
(Collection<E> toRemove) Removes elements from the underlying queue.protected boolean
toString()
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
q
-
index
protected int index
-
-
Constructor Details
-
QueueReader
-
-
Method Details
-
next
Returns (and removes) the next object in the queue, or null if there are none. -
skip
-
hasNext
public boolean hasNext()Returns true iff there is currently another object in the queue. -
remove
Removes an element from the underlying queue. This operation can only delete elements that have not yet been consumed by this reader.- Parameters:
o
- The element to remove
-
remove
Removes elements from the underlying queue. This operation can only delete elements that have not yet been consumed by this reader.- Parameters:
toRemove
- The elements to remove
-
remove
public void remove() -
clone
-
toString
-