Here you can find the source of asSet(T... a)
@SuppressWarnings("unchecked") public static <T> Set<T> asSet(T... a)
//package com.java2s; //License from project: Apache License import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.Set; public class Main { @SuppressWarnings("unchecked") public static <T> Set<T> asSet(T... a) { return a != null ? new HashSet(Arrays.asList(a)) : Collections.emptySet(); }//from w w w. ja va 2 s. c o m }