Here you can find the source of getTreeSet(Collection extends E> collection)
public static <E> Set<E> getTreeSet(Collection<? extends E> collection)
//package com.java2s; import java.util.Collection; import java.util.Comparator; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; public class Main { public static <E> Set<E> getTreeSet() { return new TreeSet<E>(); }/*from w w w . j ava 2s . c om*/ public static <E> Set<E> getTreeSet(Collection<? extends E> collection) { return new TreeSet<E>(collection); } public static <E> Set<E> getTreeSet(Comparator<? super E> comparator) { return new TreeSet<E>(comparator); } public static <E> Set<E> getTreeSet(SortedSet<E> set) { return new TreeSet<E>(set); } }