Use max() instead of sorted().last()

Proprietary

sorted().last() does an O(n log n) sort just to read the maximum. max() finds it in a single linear pass.

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