mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-27 17:15:38 +07:00
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
27 lines
666 B
HTML
27 lines
666 B
HTML
<html>
|
|
<body>
|
|
Reports unnecessary array length checks followed by array iteration. When array length is zero,
|
|
the iteration will be skipped anyway, so there's no need to check length explicitly.
|
|
<p>Example:</p>
|
|
<pre><code>
|
|
void f(String[] array) {
|
|
if (array.length != 0) { // unnecessary check
|
|
for (String str : array) {
|
|
System.out.println(str);
|
|
}
|
|
}
|
|
}
|
|
</code></pre>
|
|
<p>A quick-fix is suggested to unwrap or remove the length check:</p>
|
|
<pre><code>
|
|
void f(String[] array) {
|
|
for (String str : array) {
|
|
System.out.println(str);
|
|
}
|
|
}
|
|
</code></pre>
|
|
|
|
<!-- tooltip end -->
|
|
<p><small>New in 2022.3</small></p>
|
|
</body>
|
|
</html> |