java list to set

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

Also in Java: