This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A BlockingQueue comes with an iterator() method which is more or less unusable because its hasNext() | |
* method may return false before the last element has been placed on the queue. To indicate that the last | |
* element has been put on the queue, we use the same trick used at some airports to indicate that the last | |
* piece of baggage has been placed on the baggage conveyor belt: A red suitcase marks the end. | |
*/ | |
public class MyClass implements Iterable<String> { | |
private BlockingQueue<String> queue = new ArrayBlockingQueue<>(10); |