Files
openide/java/java-impl/resources/inspectionDescriptions/IteratorHasNextCallsIteratorNext.html
Leonid Shalupov 40795fe787 IJI-2422: community/java: move resources under resources root
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
2025-02-05 04:43:28 +00:00

15 lines
565 B
HTML

<html>
<body>
Reports implementations of <code>Iterator.hasNext()</code> or <code>ListIterator.hasPrevious()</code> that call
<code>Iterator.next()</code> or <code>ListIterator.previous()</code> on the iterator instance. Such calls are almost certainly an error, as methods
like <code>hasNext()</code> should not modify the iterators state, while <code>next()</code> should.
<p><b>Example:</b></p>
<pre><code>
class MyIterator implements Iterator&lt;Integer&gt; {
public boolean hasNext() {
return next() != null;
}
}
</code></pre>
</body>
</html>