Here you can find the source of newHashSet(E... elements)
public static <E> HashSet<E> newHashSet(E... elements)
//package com.java2s; //License from project: Open Source License import java.util.Collections; import java.util.HashSet; public class Main { public static <E> HashSet<E> newHashSet(E... elements) { HashSet<E> set = new HashSet<>(elements.length); Collections.addAll(set, elements); return set; }/*from www. j a va 2 s .c o m*/ }