Java tutorial
//package com.java2s; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; public class Main { public static <T> Set<T> asUnmodifiableSet(T[] a_array) /* */ { /* 318 */if (a_array == null) /* */ { /* 320 */return null; /* */} /* */ /* 324 */List list = Arrays.asList(a_array); /* 325 */Set set = new HashSet(list); /* 326 */return Collections.unmodifiableSet(set); /* */} }