mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
26 lines
669 B
HTML
26 lines
669 B
HTML
<html>
|
|
<body>
|
|
Reports function literal expressions that can be replaced with function references.
|
|
<p>Replacing lambdas with function references often makes code look more concise and understandable.</p>
|
|
<p><b>Example:</b></p>
|
|
<pre><code>
|
|
fun Int.isEven() = this % 2 == 0
|
|
|
|
fun example() {
|
|
val numbers = listOf(1, 2, 4, 7, 9, 10)
|
|
val evenNumbers = numbers.filter { it.isEven() }
|
|
}
|
|
</code></pre>
|
|
<p>After the quick-fix is applied:</p>
|
|
<pre><code>
|
|
fun Int.isEven() = this % 2 == 0
|
|
|
|
fun example() {
|
|
val numbers = listOf(1, 2, 4, 7, 9, 10)
|
|
val evenNumbers = numbers.filter(Int::isEven)
|
|
}
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
</body>
|
|
</html>
|