public TreeSet(Collection col) public TreeSet(SortedSet set)
import java.util.Arrays; import java.util.Set; import java.util.TreeSet; public class MainClass { public static void main(String args[]) throws Exception { String elements[] = { "A", "C", "D", "G", "F" }; Set set = new TreeSet(Arrays.asList(elements)); System.out.println(set); } }
[A, C, D, F, G]