mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
20 lines
845 B
HTML
20 lines
845 B
HTML
<html>
|
|
<body>
|
|
Reports <code>Collection.addAll()</code> and <code>Map.putAll()</code> calls immediately after an instantiation of a collection using a no-arg constructor.
|
|
<p>Such constructs can be replaced with a single call to a parametrized constructor, which simplifies the code. Also, for some collections the replacement
|
|
might be more performant.</p>
|
|
<p><b>Example:</b></p>
|
|
<pre><code>
|
|
Set<String> set = new HashSet<>();
|
|
set.addAll(Arrays.asList("alpha", "beta", "gamma"));
|
|
</code></pre>
|
|
<p>After the quick-fix is applied:</p>
|
|
<pre><code>
|
|
Set<String> set = new HashSet<>(Arrays.asList("alpha", "beta", "gamma"));
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
<p>
|
|
The JDK collection classes are supported by default.
|
|
Additionally, you can specify other classes using the <b>Classes to check</b> panel.
|
|
</body>
|
|
</html> |