@Test public void shouldAllowNullValuesInTheIterator() throws Exception { Iterator<Integer> firstIterator = iterableWith(1, null).iterator(); Iterator<Integer> secondIterator = iterableWith(2).iterator(); Iterator<Integer> chainedIterator = new ChainedIterator<Integer>(firstIterator, secondIterator); assertThat(chainedIterator.next(), is(1)); assertThat(chainedIterator.next(), is(nullValue())); assertThat(chainedIterator.next(), is(2)); }
@Override public T next() { if (hasNext()) { return currentIterator.next(); } else { throw new NoSuchElementException(); } }
ChainedIterator implements Iterator<T> { @Override public T next() { if (hasNext()) { return currentIterator.next(); } else { throw new NoSuchElementException(); } } }
ChainedIterator implements Iterator<T> { @Override public T next() { if (hasNext()) { return currentIterator.next(); } else { throw new NoSuchElementException(); } } ChainedIterator(Iterator<? extends Iterator<? extends T>> iteratorsIterator);  ChainedIterator(
            Iterator<? extends T> i1, Iterator<? extends T> i2);  ChainedIterator(
            Iterator<? extends T> i1, Iterator<? extends T> i2, Iterator<? extends T> i3);  ChainedIterator(
            Iterator<? extends T> i1, Iterator<? extends T> i2, Iterator<? extends T> i3, Iterator<? extends T> i4);  ChainedIterator(
            Iterator<? extends T> i1, Iterator<? extends T> i2, Iterator<? extends T> i3, Iterator<? extends T> i4,
            Iterator<? extends T> i5);  ChainedIterator(
            Iterator<? extends T> i1, Iterator<? extends T> i2, Iterator<? extends T> i3, Iterator<? extends T> i4,
            Iterator<? extends T> i5, Iterator<? extends T> i6);  ChainedIterator(
            Iterator<? extends T> i1, Iterator<? extends T> i2, Iterator<? extends T> i3, Iterator<? extends T> i4,
            Iterator<? extends T> i5, Iterator<? extends T> i6, Iterator<? extends T>... i7on); }
ChainedIterator implements Iterator<T> { @Override public T next() { if (hasNext()) { return currentIterator.next(); } else { throw new NoSuchElementException(); } } ChainedIterator(Iterator<? extends Iterator<? extends T>> iteratorsIterator);  ChainedIterator(
            Iterator<? extends T> i1, Iterator<? extends T> i2);  ChainedIterator(
            Iterator<? extends T> i1, Iterator<? extends T> i2, Iterator<? extends T> i3);  ChainedIterator(
            Iterator<? extends T> i1, Iterator<? extends T> i2, Iterator<? extends T> i3, Iterator<? extends T> i4);  ChainedIterator(
            Iterator<? extends T> i1, Iterator<? extends T> i2, Iterator<? extends T> i3, Iterator<? extends T> i4,
            Iterator<? extends T> i5);  ChainedIterator(
            Iterator<? extends T> i1, Iterator<? extends T> i2, Iterator<? extends T> i3, Iterator<? extends T> i4,
            Iterator<? extends T> i5, Iterator<? extends T> i6);  ChainedIterator(
            Iterator<? extends T> i1, Iterator<? extends T> i2, Iterator<? extends T> i3, Iterator<? extends T> i4,
            Iterator<? extends T> i5, Iterator<? extends T> i6, Iterator<? extends T>... i7on); @Override boolean hasNext(); @Override T next(); @Override void remove(); @Override String toString(); }
ChainedIterator implements Iterator<T> { @Override public T next() { if (hasNext()) { return currentIterator.next(); } else { throw new NoSuchElementException(); } } ChainedIterator(Iterator<? extends Iterator<? extends T>> iteratorsIterator);  ChainedIterator(
            Iterator<? extends T> i1, Iterator<? extends T> i2);  ChainedIterator(
            Iterator<? extends T> i1, Iterator<? extends T> i2, Iterator<? extends T> i3);  ChainedIterator(
            Iterator<? extends T> i1, Iterator<? extends T> i2, Iterator<? extends T> i3, Iterator<? extends T> i4);  ChainedIterator(
            Iterator<? extends T> i1, Iterator<? extends T> i2, Iterator<? extends T> i3, Iterator<? extends T> i4,
            Iterator<? extends T> i5);  ChainedIterator(
            Iterator<? extends T> i1, Iterator<? extends T> i2, Iterator<? extends T> i3, Iterator<? extends T> i4,
            Iterator<? extends T> i5, Iterator<? extends T> i6);  ChainedIterator(
            Iterator<? extends T> i1, Iterator<? extends T> i2, Iterator<? extends T> i3, Iterator<? extends T> i4,
            Iterator<? extends T> i5, Iterator<? extends T> i6, Iterator<? extends T>... i7on); @Override boolean hasNext(); @Override T next(); @Override void remove(); @Override String toString();  }