Iterator.hasNext()
or ListIterator.hasPrevious()
that call
Iterator.next()
or ListIterator.previous()
on the iterator instance. Such calls are almost certainly an error, as methods
like hasNext()
should not modify the iterators state, while next()
should.
Example:
class MyIterator implements Iterator<Integer> { public boolean hasNext() { return next() != null; } }