Files
2025-02-05 04:43:28 +00:00

24 lines
885 B
HTML

<html>
<body>
Reports redundant calls to unmodifiable collection wrappers from the
<code>Collections</code> class.
<p>If the argument that is passed to an unmodifiable
collection wrapper is already immutable, such a wrapping becomes redundant.</p>
<p>Example:</p>
<pre><code>
List&lt;String&gt; x = Collections.unmodifiableList(Collections.singletonList("abc"));
</code></pre>
<p>After the quick-fix is applied:</p>
<pre><code>
List&lt;String&gt; x = Collections.singletonList("abc");
</code></pre>
<p>In order to detect the methods that return unmodifiable collections, the
inspection uses the <code>org.jetbrains.annotations.Unmodifiable</code>
and <code>org.jetbrains.annotations.UnmodifiableView</code> annotations.
Use them to extend the inspection to your own unmodifiable collection
wrappers.</p>
<!-- tooltip end -->
<p><small>New in 2020.3</small></p>
</body>
</html>