Here you can find the source of asSet(T... elements)
public static <T> Set<T> asSet(T... elements)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static <T> Set<T> asSet(T... elements) { return asLinkedSet(elements); }//from ww w . j a v a 2s . co m public static <T> LinkedHashSet<T> asLinkedSet(T... elements) { LinkedHashSet<T> set = new LinkedHashSet<>(); for (T element : elements) { set.add(element); } return set; } }