Here you can find the source of cvtListToTreeSet(List list)
public static TreeSet cvtListToTreeSet(List list)
//package com.java2s; import java.util.Iterator; import java.util.List; import java.util.TreeSet; public class Main { public static TreeSet cvtListToTreeSet(List list) { TreeSet treeSet = new TreeSet(); if (treeSet != null) { Iterator iter = list.iterator(); while (iter.hasNext()) { treeSet.add(iter.next()); }//from w w w . j a v a2 s .co m } return treeSet; } }