Copy all elements of Java TreeSet to an Object Array Example
import java.util.TreeSet; publicclass Main { publicstaticvoid main(String[] args) { TreeSet<Integer> tSet = new TreeSet<Integer>(); tSet.add(newInteger("1")); tSet.add(newInteger("2")); tSet.add(newInteger("3")); Object[] objArray = tSet.toArray(); for (Object obj: objArray){ System.out.println(obj); } } }
Related examples in the same category