Here you can find the source of asSet(T... array)
public static <T> Set<T> asSet(T... array)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static <T> Set<T> asSet(T... array) { if (array == null) { return null; }//from w w w . j a v a 2 s .c om Set<T> set = new HashSet<T>(array.length * 2); for (T t : array) { set.add(t); } return set; } }