Search code examples
javacollections

Easiest way to convert a List to a Set in Java


What is the easiest way to convert a List to a Set in Java?


Solution

  • Set<Foo> foo = new HashSet<Foo>(myList);