I’m looking for a very simple way to create a Set.
Arrays.asList("a", "b" ...)
creates a List<String>
Is there anything similar for Set
?
Advertisement
Answer
Now with Java 8 you can do this without need of third-party framework:
Set<String> set = Stream.of("a","b","c").collect(Collectors.toSet());
See Collectors.
Enjoy!