作者在 2010-05-21 10:13:52 发布以下内容
import java.util.TreeSet;
import java.util.Iterator;
public class TestTreeSet{
public static void main(String[] args) {
TreeSet ts = new TreeSet();
ts.add("orange");
ts.add("banana");
ts.add("apple");
ts.add("grape");
Iterator it = ts.iterator();
while(it.hasNext()){
String fruit = (String)it.next();
System.out.println(fruit);
}
}
}
import java.util.Iterator;
public class TestTreeSet{
public static void main(String[] args) {
TreeSet ts = new TreeSet();
ts.add("orange");
ts.add("banana");
ts.add("apple");
ts.add("grape");
Iterator it = ts.iterator();
while(it.hasNext()){
String fruit = (String)it.next();
System.out.println(fruit);
}
}
}