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