Java tutorial
//package com.java2s; import java.util.Arrays; import java.util.HashSet; import java.util.Set; public class Main { public static <T> Set<T> asSet(T... array) { Set<T> result = new HashSet<>(); result.addAll(Arrays.asList(array)); return result; } }