Here you can find the source of hashSetOf(T... elements)
@SafeVarargs public static <T> Set<T> hashSetOf(T... elements)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { @SafeVarargs public static <T> Set<T> hashSetOf(T... elements) { HashSet<T> set = new HashSet<>(); for (T element : elements) { set.add(element);/*from w w w . ja v a 2 s. c om*/ } return set; } }