MultiIterator implements Iterator<T>, Serializable, AutoCloseable { @Override public boolean hasNext() { if (this.current >= this.iterators.size()) return false; Iterator<T> currentIterator = this.iterators.get(this.current); while (true) { if (currentIterator.hasNext()) { return true; } else { this.current++; if (this.current >= iterators.size()) break; currentIterator = iterators.get(this.current); } } return false; }  void addIterator(final Iterator<T> iterator); @Override boolean hasNext(); @Override void remove(); @Override T next(); void clear(); @Override void close();  }
@Test public void shouldNotHaveNextIfNoIteratorsAreAdded() { final Iterator<String> itty = new MultiIterator<>(); assertFalse(itty.hasNext()); }