Use maxOf { selector } instead of map { selector }.max()
ProprietarymaxOf walks the input once and tracks the running maximum without materializing the intermediate List<Int>.
org. openrewrite. kotlin. performance. UseMaxOfWithSelector$KtRecipemod 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.