Here you can find the source of CreateSortedSet(T[] array)
public static <T> Set<T> CreateSortedSet(T[] array)
//package com.java2s; import java.util.Set; import java.util.TreeSet; public class Main { public static <T> Set<T> CreateSortedSet(T[] array) { Set<T> set = new TreeSet<T>(); for (T v : array) { set.add(v);//w w w . j a v a 2 s . co m } return set; } }