Prefer Set.of(..)
MSALPrefer 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. MigrateCollectionsSingletonSetmod run . --recipe= org. openrewrite. java. migrate. util. MigrateCollectionsSingletonSetInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.