TreeSet

import java.util.*;
public class ab {
 public static void main(String[] args) {
  TreeSet<String> set = new TreeSet<String>();               
  set.add("justin");
  set.add("caterpillar");       
  set.add("momor");
  set.add("justin");
  
  Iterator<String> iterator = set.iterator();       
  while(iterator.hasNext()) {
   System.out.print(iterator.next() + " ");
  }
  System.out.println();
  }
}

posted @ 2012-01-15 15:56  greencolor  阅读(159)  评论(0编辑  收藏  举报