Java tutorial
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); import java.util.HashSet; import java.util.Set; public class Main { /** * Returns a set containing the passed elements. */ public static <T> Set<T> asSet(T... elems) { Set<T> result = new HashSet<T>(); for (T elem : elems) result.add(elem); return result; } }