LoadFuncTupleIterator implements Iterator<Tuple> { @Override public Tuple next() { if (!hasNext()) throw new NoSuchElementException(); Tuple next = tuple; hasNextCalled = false; tuple = null; return next; } LoadFuncTupleIterator(LoadFunc loadFunc); @Override boolean hasNext(); @Override Tuple next(); @Override void remove();  }
@Test public void nextWithoutHasNext() { LoadFuncTupleIterator itr = new LoadFuncTupleIterator(loadFunc); for (int i = 0; i < DATA.length; ++i) { Tuple t = itr.next(); Assert.assertNotNull(t); Assert.assertEquals(DATA[i], t); } }