Use mapNotNull { f } instead of map { f }.filterNotNull()

Proprietary

mapNotNull drops nulls in the same pass that produces them. map { f }.filterNotNull() materializes the full List<R?> first.

org.openrewrite.kotlin.performance.UseMapNotNullForMapFilterNotNull$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.performance.UseMapNotNullForMapFilterNotNull$KtRecipe'

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.