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