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