Use maxOf { selector } instead of map { selector }.max()

Proprietary

maxOf walks the input once and tracks the running maximum without materializing the intermediate List<Int>.

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