Use Kotlin collection extensions instead of java.util.Collections
ProprietaryReplaces 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$KtRecipemod 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.
- Use
MutableList.sort()instead ofCollections.sort(list) - Use
MutableList.reverse()instead ofCollections.reverse(list) - Use
MutableList.shuffle()instead ofCollections.shuffle(list) - Use
listOf(x)instead ofCollections.singletonList(x) - Use
setOf(x)instead ofCollections.singleton(x) - Use
Collection.max()instead ofCollections.max(coll) - Use
Collection.min()instead ofCollections.min(coll)