Here you can find the source of asSet(T... a)
public static <T> Set<T> asSet(T... a)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static <T> Set<T> asSet(T... a) { if (a.length > 1) return new HashSet<T>(Arrays.<T> asList(a)); else//from w w w . java2 s .c om return Collections.singleton(a[0]); } }