arraylist to set java 8 code example Example: arraylist to set java 8 Set<Foo> foo = new HashSet<Foo>(myList);