Files
openide/java/java-impl/resources/inspectionDescriptions/LoopStatementsThatDontLoop.html
2025-02-05 04:43:28 +00:00

19 lines
556 B
HTML

<html>
<body>
Reports any instance of <code>for</code>,
<code>while</code>, and <code>do</code> statements whose
bodies will be executed once at most. Normally, this is an indication of a bug.
<!-- tooltip end -->
<p>
Use the <b>Ignore enhanced for loops</b> option to ignore the foreach loops.
They are sometimes used to perform an action only on the first item of an iterable in a compact way.
</p>
<p>Example:</p>
<pre><code>
<b>for</b> (String s : stringIterable) {
doSomethingOnFirstString(s);
<b>break</b>;
}
</code></pre>
</body>
</html>