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

27 lines
715 B
HTML

<html>
<body>
<p>
Reports <code>while</code> loops that could be more effectively written as <code>do-while</code> loops.
There are <code>while</code> loops where the code just before the loop is identical to the code in the body of the loop.
Replacing with a <code>do-while</code> loop removes the duplicated code.
For <code>while</code> loops without such duplicated code, the quick fix is offered in the editor as well, but without highlighting.
</p>
<p><b>Example:</b></p>
<pre><code>
foo();
while (x) {
foo();
}
</code></pre>
<p>Can be replaced with:</p>
<pre><code>
do {
foo();
} while (x);
</code></pre>
<!-- tooltip end -->
<p>
<small>New in 2024.1</small>
</p>
</body>
</html>