Use Kotlin collection extensions instead of java.util.Collections

Proprietary

Replaces JVM-only java.util.Collections static helpers with the multiplatform Kotlin equivalents: list.sort(), list.reverse(), list.shuffle(), listOf(x)/setOf(x), and Collection.max()/min().

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

Recipe list

It runs these recipes, in this order.

  1. Use MutableList.sort() instead of Collections.sort(list)
  2. Use MutableList.reverse() instead of Collections.reverse(list)
  3. Use MutableList.shuffle() instead of Collections.shuffle(list)
  4. Use listOf(x) instead of Collections.singletonList(x)
  5. Use setOf(x) instead of Collections.singleton(x)
  6. Use Collection.max() instead of Collections.max(coll)
  7. Use Collection.min() instead of Collections.min(coll)