Use distinct() instead of toSet().toList()
Proprietarydistinct() returns a List with duplicates removed in one pass. toSet().toList() allocates a set and then copies its contents into a list — two allocations to do the same job, and the order semantics differ subtly because hash-based sets don't preserve insertion order across all platforms.
org. openrewrite. kotlin. bestpractices. UseToListForToSetThenToList$KtRecipemod run . --recipe= 'org. openrewrite. kotlin. bestpractices. UseToListForToSetThenToList$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.