mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
17 lines
754 B
HTML
17 lines
754 B
HTML
<html>
|
|
<body>
|
|
Reports <code>filter…</code> calls from the standard library on already filtered collections.
|
|
<p>Several functions from the standard library such as <code>filterNotNull()</code> or <code>filterIsInstance</code>
|
|
have sense only when they are called on receivers that have types distinct from the resulting one. Otherwise,
|
|
such calls can be omitted as the result will be the same.</p>
|
|
<p><b>Remove redundant call</b> quick-fix can be used to amend the code automatically.</p>
|
|
<p>Example:</p>
|
|
<pre><code>
|
|
fun test(list: List<String>) {
|
|
val x = list.filterNotNull() // quick-fix simplifies to 'list'
|
|
val y = list.filterIsInstance<String>() // quick-fix simplifies to 'list'
|
|
}
|
|
</code></pre>
|
|
</body>
|
|
</html>
|