Java examples for Collection Framework:TreeSet
Copy all elements of TreeSet to an Object Array
import java.util.TreeSet; public class Main { public static void main(String[] args) { TreeSet tSet = new TreeSet(); tSet.add(new Integer("1")); tSet.add(new Integer("2")); tSet.add(new Integer("3")); Object[] objArray = tSet.toArray(); //from w w w . ja v a 2s .co m for(int index=0; index < objArray.length ; index++) System.out.println(objArray[index]); } }