Java tutorial
//package com.java2s; /** * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ import java.util.Arrays; import java.util.HashSet; import java.util.Set; public class Main { /** * Returns the items as a populated set. * * @param items * Object[] * @return Set */ public static <T> Set<T> asSet(T[] items) { return new HashSet<>(Arrays.asList(items)); } }