Files
openide/java/java-impl/resources/inspectionDescriptions/CollectionAddAllCanBeReplacedWithConstructor.html
Leonid Shalupov 40795fe787 IJI-2422: community/java: move resources under resources root
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
2025-02-05 04:43:28 +00:00

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&lt;String&gt; set = new HashSet&lt;&gt;();
set.addAll(Arrays.asList("alpha", "beta", "gamma"));
</code></pre>
<p>After the quick-fix is applied:</p>
<pre><code>
Set&lt;String&gt; set = new HashSet&lt;&gt;(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>