java arraylist to set code example Example 1: java list to set Set<Foo> foo = new HashSet<Foo>(myList); Example 2: .set arraylist Java arraylist set()