Java examples for java.util:Set Creation
Create unmodifiable Set from Array
//package com.java2s; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.Set; public class Main { public static <T> Set<T> setOf(final T... items) { return Collections.unmodifiableSet(new HashSet<T>(Arrays .asList(items)));//from w w w . j ava2 s. c o m } }