mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
22 lines
675 B
HTML
22 lines
675 B
HTML
<html>
|
|
<body>
|
|
Reports unnecessarily complex collection operations which have simpler alternatives.
|
|
<p>Example:</p>
|
|
<pre><code>
|
|
void f(String[] array, Collection<String> collection) {
|
|
String[] strings = Arrays.asList(array).subList(0, 10).toArray(new String[0]);
|
|
boolean contains = collection.containsAll(Collections.singletonList("x"));
|
|
}
|
|
</code></pre>
|
|
<p>After the quick-fix is applied:</p>
|
|
<pre><code>
|
|
void f(String[] array, Collection<String> collection) {
|
|
String[] strings = Arrays.copyOf(array, 10);
|
|
boolean contains = collection.contains("x");
|
|
}
|
|
</code></pre>
|
|
|
|
<!-- tooltip end -->
|
|
<p><small>New in 2018.1</small></p>
|
|
</body>
|
|
</html> |