Inspectopedia Help

Call chain on collection type can be simplified

Reports two-call chains replaceable by a single call.

It can help you to avoid redundant code execution.

The quick-fix replaces the call chain with a single call.

Example:

fun main() { listOf(1, 2, 3).filter { it > 1 }.count() }

After the quick-fix is applied:

fun main() { listOf(1, 2, 3).count { it > 1 } }

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Kotlin, @snapshot@

Last modified: 13 July 2023