Java tutorial
//package com.java2s; import java.util.*; public class Main { public static <T> HashSet<T> newHashSet() { return new HashSet<T>(); } @SafeVarargs public static <T> HashSet<T> newHashSet(T... ts) { HashSet<T> set = new HashSet<>(); for (T t : ts) { set.add(t); } return set; } }