Use filterNotTo(mutableListOf(), p) instead of filterNot(p).toMutableList()
ProprietaryfilterNot { p } allocates a List<T> and toMutableList copies it. filterNotTo(mutableListOf(), p) writes directly into the target without the intermediate.
org. openrewrite. kotlin. performance. UseFilterNotToForFilterNotToMutableList$KtRecipemod run . --recipe= 'org. openrewrite. kotlin. performance. UseFilterNotToForFilterNotToMutableList$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.