Find if (x != null) f(x) else null patterns

Proprietary

if (x != null) f(x) else null is x?.let { f(it) } written long-hand. The ?.let { } form is more concise and (when f is a member call) collapses further to x?.f(...).

org.openrewrite.kotlin.functional.FindUseLetForNullableMap$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.functional.FindUseLetForNullableMap$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.