Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.HashSet; import java.util.Set; public class Main { /** * Creates a new list with the given elements * @param values * @return */ @SafeVarargs public static <T> Set<T> newSet(T... values) { HashSet<T> set = new HashSet<>(values.length); for (T element : values) { set.add(element); } return set; } }