This example will show how to convert a Stream into a Hashset using Java 8. A Collector is a reduction operation that will accumulate elements from a stream into a cumulative result. We must supply a Collector in order to gather all the Stream’s items in a Set which we can do by using a connivence method toSet() from the Collectors utility class.