fork download
  1.  
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. class MySetIteration {
  8.  
  9. public static void main(String a[]){
  10.  
  11. TreeSet<String> ts = new TreeSet<String>();
  12. ts.add("one");
  13. ts.add("two");
  14. ts.add("three");
  15. Iterator<String> itr = ts.iterator();
  16. while(itr.hasNext()){
  17. System.out.println(itr.next());
  18. }
  19. }
  20. }
Success #stdin #stdout 0.04s 4386816KB
stdin
Standard input is empty
stdout
one
three
two