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