how to create a set from an arraylist in java code example Example: java list to set Set<Foo> foo = new HashSet<Foo>(myList);