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