Why does the iterator.hasNext not work with BlockingQueue? <p>I was trying to use the iterator methods on a BlockingQueue and discovered that hasNext() is non-blocking - i.e. it will not wait until more elements are added and will instead return false when there are no elements. </p> <p>So here are the questions :</p> <ol> <li>Is this bad design, or wrong expectation?</li> <li>Is there a way to use the blocking methods of the BLockingQueue with its parent Collection class methods (e.g. if some method were expecting a collection, can I pass a blocking queue and hope that its processing will wait until the Queue has more elements)</li> </ol> <p>Here is a sample code block </p> <pre><code>public class SomeContainer{ public static void main(String[] args){ BlockingQueue bq = new LinkedBlockingQueue(); SomeContainer h = new SomeContainer(); Producer p = new Producer(bq); Consumer c = new Consumer(bq); p.produce(); c.consume(); } static class Producer{ BlockingQueue q; public Producer(BlockingQueue q) { this.q = q; } void produce(){ new Thread(){ public void run() { for(int i=0; i&lt;10; i++){ for(int j=0;j&lt;10; j++){ q.add(i+" - "+j); } try { Thread.sleep(30000); } catch (InterruptedException e) { e.printStackTrace(); } } }; }.start(); } } static class Consumer{ BlockingQueue q; public Consumer(BlockingQueue q) { this.q = q; } void consume() { new Thread() { public void run() { Iterator itr = q.iterator(); while (itr.hasNext()) System.out.println(itr.next()); } }.start(); } } } </code></pre> <p>This Code only prints the iteration once at the most. </p>