@Test public void testReferenceToPreviousElement() { final LsaExtIteratorImpl iterator = new LsaExtIteratorImpl(); assertEquals(iterator.next(), "1"); assertEquals(iterator.next(), "2"); assertThat(iterator.next, is(nullValue())); }
@SuppressWarnings("ResultOfMethodCallIgnored") @Override public T next() { if (!isInit) { hasNext(); } if (!hasNext) { throw new NoSuchElementException(); } final T result = next; nextIteration(); if (!hasNext) { next = null; } return result; }
LsaExtIterator implements Iterator<T> { @SuppressWarnings("ResultOfMethodCallIgnored") @Override public T next() { if (!isInit) { hasNext(); } if (!hasNext) { throw new NoSuchElementException(); } final T result = next; nextIteration(); if (!hasNext) { next = null; } return result; } }
LsaExtIterator implements Iterator<T> { @SuppressWarnings("ResultOfMethodCallIgnored") @Override public T next() { if (!isInit) { hasNext(); } if (!hasNext) { throw new NoSuchElementException(); } final T result = next; nextIteration(); if (!hasNext) { next = null; } return result; }  }
LsaExtIterator implements Iterator<T> { @SuppressWarnings("ResultOfMethodCallIgnored") @Override public T next() { if (!isInit) { hasNext(); } if (!hasNext) { throw new NoSuchElementException(); } final T result = next; nextIteration(); if (!hasNext) { next = null; } return result; }  @Override boolean hasNext(); @SuppressWarnings("ResultOfMethodCallIgnored") @Override T next(); @Override void remove(); }
LsaExtIterator implements Iterator<T> { @SuppressWarnings("ResultOfMethodCallIgnored") @Override public T next() { if (!isInit) { hasNext(); } if (!hasNext) { throw new NoSuchElementException(); } final T result = next; nextIteration(); if (!hasNext) { next = null; } return result; }  @Override boolean hasNext(); @SuppressWarnings("ResultOfMethodCallIgnored") @Override T next(); @Override void remove();  }