set.add("b"); set.add("c"); set = Collections.unmodifiableSet(set); Set<String> set = Collections.unmodifiableSet( new HashSet<>(Arrays.asList("a", "b", "c"))); Set<String> set = Collections.unmodifiableSet( Stream.of("a", "b", "c").collect(toSet())); Set<String> set = Set.of("a", "b", "c");