public static <T>
    Collector<T, ?, Set<T>> toSet() {
        return new CollectorImpl<>((Supplier<Set<T>>) HashSet::new, Set::add,
                                   (left, right) -> { left.addAll(right); return left; },
                                   CH_UNORDERED_ID);
    }
public static < T > Collector < T , ? , Set < T > > toSet ( ) { return new CollectorImpl < > ( ( Supplier < Set < T > > ) HashSet :: new , Set :: add , ( left , right ) -> { left . addAll ( right ) ; return left ; } , CH_UNORDERED_ID ) ; }
Returns a {@code Collector} that accumulates the input elements into a
new {@code Set}. There are no guarantees on the type, mutability,
serializability, or thread-safety of the {@code Set} returned; if more
control over the returned {@code Set} is required, use
{@link #toCollection(Supplier)}.

<p>This is an {@link Collector.Characteristics#UNORDERED unordered}
Collector.

@param <T> the type of the input elements
@return a {@code Collector} which collects all the input elements into a
{@code Set}