Prefer Set.of(..)

MSAL

Prefer Set.of(..) instead of using Collections.singleton() in Java 9 or higher. Note that the resulting Set is not behaviorally equivalent: Set.of(..) throws NullPointerException when probed with contains(null), whereas Collections.singleton(..) returns false.

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

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