Combine Collection Operations (ARCH8077)
Key kotlin.performance.combine-collection-operations · Severity info · Category performance
Flags filter { }.first() / filter { }.count() / filter { }.isNotEmpty() / map { }.filterNotNull() chains that have a single-pass equivalent.
Incorrect
Section titled “Incorrect”users.filter { it.admin }.first()Correct
Section titled “Correct”users.first { it.admin }Use first { }, count { }, any { }, mapNotNull { }.