Java recently introduced the Set.of() static methods for creating immutable sets. These new methods could be used here and here instead of new HashSet<>(Arrays.asList(. This would shorten the code and make the sets immutable, which seems to be the intention of the code.