Java examples for java.util:HashSet
Create new HashSet by variable length parameter
//package com.book2s; import java.util.HashSet; public class Main { public static void main(String[] argv) { System.out.println(newHashSet()); }// w w w. j av a2 s . c o m public static <T> HashSet<T> newHashSet() { return new HashSet<T>(); } @SafeVarargs public static <T> HashSet<T> newHashSet(T... ts) { HashSet<T> set = new HashSet<T>(); for (T t : ts) { set.add(t); } return set; } }