Use last() instead of reversed().first()
Proprietaryreversed() allocates an intermediate reversed copy. last() walks to the same element directly.
org. openrewrite. kotlin. performance. UseLastForReversedFirst$KtRecipemod run . --recipe= 'org. openrewrite. kotlin. performance. UseLastForReversedFirst$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.