Java tutorial
//package com.java2s; import java.util.Collection; import java.util.Comparator; import java.util.SortedSet; import java.util.TreeSet; public class Main { public static <E> TreeSet<E> getTreeSet() { return new TreeSet<E>(); } public static <E> TreeSet<E> getTreeSet(Collection<? extends E> collection) { return new TreeSet<E>(collection); } public static <E> TreeSet<E> getTreeSet(Comparator<? super E> comparator) { return new TreeSet<E>(comparator); } public static <E> TreeSet<E> getTreeSet(SortedSet<E> set) { return new TreeSet<E>(set); } }