Java tutorial
//package com.java2s; /** * Copyright (c) 2005-2012 springside.org.cn * * Licensed under the Apache License, Version 2.0 (the "License"); */ import java.util.HashSet; import java.util.Set; public class Main { public static <T> Set<T> newSet(T... values) { Set<T> set = new HashSet<T>(); for (T value : values) { set.add(value); } return set; } }