Prefer List.of(..)

MSAL

Prefer List.of(..) instead of using Collections.singletonList() in Java 9 or higher. Note that the resulting List is not behaviorally equivalent: List.of(..) throws NullPointerException when probed with contains(null), indexOf(null), or lastIndexOf(null), whereas Collections.singletonList(..) returns false/-1.

org.openrewrite.java.migrate.util.MigrateCollectionsSingletonList
mod run . --recipe=org.openrewrite.java.migrate.util.MigrateCollectionsSingletonList

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.