ACompositeIterator implements Iterator<T> { @Override public T next() { refreshCurrent (); return curIterator.next(); } ACompositeIterator(Iterator<Iterator<T>> itit);  ACompositeIterator(Iterable<Iterator<T>> itit); @Override boolean hasNext(); @Override T next(); @Override void remove();  }
@Test public void testPureNext() { final ACompositeIterator<Integer> iter = new ACompositeIterator<> (Arrays.asList ( Arrays.asList (1,2,3,4).iterator (), Arrays.asList (5,6,7,8).iterator (), Arrays.asList (9,10).iterator () )); int expected = 1; while (expected <= 10) { int elem = iter.next (); assertEquals (expected, elem); expected++; } expectedException.expect (NoSuchElementException.class); iter.next (); }