摘要: 1 import java.util.*; 2 class TreeMapTest 3 { 4 public static void main(String[] args) 5 { 6 TreeMap<Student,String> tm=new TreeMap<Student,String>(new mycompare()); //new TreeMap<Student,String>(); 不带参数的构造函数,Student中 已经写了compareTo 方法比较 7 tm.put(new Student("lisi01",25),& 阅读全文
posted @ 2012-01-06 16:46 pinotao 阅读(352) 评论(0) 推荐(0) 编辑
摘要: 1 import java.util.*; 2 class HashMapTest //无序 3 { 4 public static void main(String [] args) 5 { 6 HashMap<Student,String> hs=new HashMap<Student,String>(); 7 hs.put(new Student("lisi01",21),"beijing"); 8 hs.put(new Student("lisi02",22),"tianjing") 阅读全文
posted @ 2012-01-06 15:56 pinotao 阅读(162) 评论(0) 推荐(0) 编辑