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

22 lines
800 B
HTML

<html>
<body>
Reports attempts to instantiate a new <code>Collection</code> object without specifying
an initial capacity.
<p>
If no initial capacity is specified, a default capacity is used, which will rarely be optimal. Failing
to specify initial capacities for collections may result in performance issues if space needs to be reallocated and
memory copied when the initial capacity is exceeded.
This inspection checks allocations of classes listed in the inspection's settings.
</p>
<p><b>Example:</b></p>
<pre><code>
new HashMap&lt;String, String&gt;();
</code></pre>
<!-- tooltip end -->
<p>Use the following options to configure the inspection:</p>
<ul>
<li>List collection classes that should be checked.</li>
<li>Whether to ignore field initializers.</li>
</ul>
</body>
</html>