TreeSet练习

import java.util.TreeSet;
import java.util.Iterator;

public class TreeSetTest {
 public static void main(String[] args) {
  TreeSet tree = new TreeSet();
  tree.add("China");
  tree.add("America");
  tree.add("Japan");
  tree.add("Chinese");
  Iterator iter = tree.iterator();
  while (iter.hasNext()) {
   System.out.println(iter.next());
  }
 }
}

你可能感兴趣的:(TreeSet练习)