@Test(timeout = 8000) public void nonempty_iterator_test() { Iterator<?> iterator = blockingIterator(Stream.of("foobar").iterator()); assertTrue(iterator.hasNext()); assertEquals("foobar", iterator.next()); assertFalse(iterator.hasNext()); }
@SneakyThrows public synchronized T next() { if (exception != null) throw exception; try { final T result = queue_.remove(0); fire_(); return result; } catch (IndexOutOfBoundsException ex) { LOG.log(Level.SEVERE, "next() called on empty queue!", ex); throw ex; } }
BufferedIterator { @SneakyThrows public synchronized T next() { if (exception != null) throw exception; try { final T result = queue_.remove(0); fire_(); return result; } catch (IndexOutOfBoundsException ex) { LOG.log(Level.SEVERE, "next() called on empty queue!", ex); throw ex; } } }
BufferedIterator { @SneakyThrows public synchronized T next() { if (exception != null) throw exception; try { final T result = queue_.remove(0); fire_(); return result; } catch (IndexOutOfBoundsException ex) { LOG.log(Level.SEVERE, "next() called on empty queue!", ex); throw ex; } } BufferedIterator(Executor work_queue, Iterator<? extends T> iter, int queue_size);  BufferedIterator(Iterator<? extends T> iter, int queue_size);  BufferedIterator(Executor work_queue, Iterator<? extends T> iter);  BufferedIterator(Iterator<? extends T> iter); }
BufferedIterator { @SneakyThrows public synchronized T next() { if (exception != null) throw exception; try { final T result = queue_.remove(0); fire_(); return result; } catch (IndexOutOfBoundsException ex) { LOG.log(Level.SEVERE, "next() called on empty queue!", ex); throw ex; } } BufferedIterator(Executor work_queue, Iterator<? extends T> iter, int queue_size);  BufferedIterator(Iterator<? extends T> iter, int queue_size);  BufferedIterator(Executor work_queue, Iterator<? extends T> iter);  BufferedIterator(Iterator<? extends T> iter); synchronized boolean atEnd(); synchronized boolean nextAvail(); void waitAvail(); void waitAvail(long tv, TimeUnit tu); @SneakyThrows synchronized T next(); void setWakeup(Runnable wakeup); void setWakeup(Runnable wakeup, long tv, TimeUnit tu); }
BufferedIterator { @SneakyThrows public synchronized T next() { if (exception != null) throw exception; try { final T result = queue_.remove(0); fire_(); return result; } catch (IndexOutOfBoundsException ex) { LOG.log(Level.SEVERE, "next() called on empty queue!", ex); throw ex; } } BufferedIterator(Executor work_queue, Iterator<? extends T> iter, int queue_size);  BufferedIterator(Iterator<? extends T> iter, int queue_size);  BufferedIterator(Executor work_queue, Iterator<? extends T> iter);  BufferedIterator(Iterator<? extends T> iter); synchronized boolean atEnd(); synchronized boolean nextAvail(); void waitAvail(); void waitAvail(long tv, TimeUnit tu); @SneakyThrows synchronized T next(); void setWakeup(Runnable wakeup); void setWakeup(Runnable wakeup, long tv, TimeUnit tu);  }