Use first() instead of reversed().last()

Proprietary

reversed() allocates an intermediate reversed copy. first() returns the same element directly.

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