@Test(expected = NoSuchElementException.class) public void iterateBeyondOuterList() { NestedIterator<String> nestedIterator = new NestedIterator<>( Collections.emptyList()); nestedIterator.next(); }
@Override public T next() { if (this.innerIterator == null) { throw new NoSuchElementException(); } T result = this.innerIterator.next(); if (!this.innerIterator.hasNext()) { advanceOuterIterator(); } return result; }
NestedIterator implements Iterator<T> { @Override public T next() { if (this.innerIterator == null) { throw new NoSuchElementException(); } T result = this.innerIterator.next(); if (!this.innerIterator.hasNext()) { advanceOuterIterator(); } return result; } }
NestedIterator implements Iterator<T> { @Override public T next() { if (this.innerIterator == null) { throw new NoSuchElementException(); } T result = this.innerIterator.next(); if (!this.innerIterator.hasNext()) { advanceOuterIterator(); } return result; } NestedIterator(Iterable<? extends Iterable<T>> iterableOfIterables); }
NestedIterator implements Iterator<T> { @Override public T next() { if (this.innerIterator == null) { throw new NoSuchElementException(); } T result = this.innerIterator.next(); if (!this.innerIterator.hasNext()) { advanceOuterIterator(); } return result; } NestedIterator(Iterable<? extends Iterable<T>> iterableOfIterables); @Override boolean hasNext(); @Override T next(); @Override void remove(); }
NestedIterator implements Iterator<T> { @Override public T next() { if (this.innerIterator == null) { throw new NoSuchElementException(); } T result = this.innerIterator.next(); if (!this.innerIterator.hasNext()) { advanceOuterIterator(); } return result; } NestedIterator(Iterable<? extends Iterable<T>> iterableOfIterables); @Override boolean hasNext(); @Override T next(); @Override void remove();  }