
JAVA
beecindy
hi
展开
-
HashSet与TreeSet
HashSetpublic class HashSetTest {public static void main(String []args){HashSet hs=new HashSet();/* hs.add("one");hs.add("two");hs.add("three");hs.add("one");*/hs.add(new Student(1原创 2010-03-26 18:22:00 · 514 阅读 · 0 评论 -
HashMap
hashmapimport java.util.*;public class HashMapTest{public static void printElements(Collection c){Iterator it=c.iterator();while(it.hasNext()){System.out.println(it.next());}}p原创 2010-03-26 18:22:00 · 345 阅读 · 0 评论 -
Vector
vectorimport java.util.*;class MyCompare implements Comparator // 实现Comparator,定义自己的比较方法{public int compare(Object o1, Object o2) {Elem e1 = (Elem) o1;Elem e2 = (Elem) o2;if (e1.get() >原创 2010-03-26 18:21:00 · 312 阅读 · 0 评论