ImmutableSet.of(..)
if the returned type is immediately down-cast. Java 9 introduced List#of(..)
, Map#of(..)
, Set#of(..)
which is similar to ImmutableList#of(..)
, ImmutableMap#of(..)
, ImmutableSet#of(..)
, but has a subtle difference. As per the Java 9 documentation, Set.of
provides an unspecified iteration order on the set of elements and is subject to change, whereas Guava ImmutableSet
preserves the order from construction time. This is worth pointing out in case your usage calls for iteration order being important.-Drewrite.activeRecipesorg.openrewrite.java.migrate.guava.NoGuavaImmutableSetOf