how to convert list to set. code example Example: java list to set Set<Foo> foo = new HashSet<Foo>(myList);