- import java.util.*;
- class Student
- {
- private String name;
- private String id;
- Student(String name,String id)
- {
- this.name = name;
- this.id = id;
- }
- public String toString()
- {
- return name+";;;"+id;
- }
- }
- class Demo4
- {
- public static void main(String[] args)
- {
-
-
-
- TreeMap<String,List<Student>> tr = new TreeMap<String,List<Student>>();
- List<Student> yure = new ArrayList<Student>();
- List<Student> jiuye = new ArrayList<Student>();
- tr.put("yurenban",yure);
- tr.put("jiuyeban",jiuye);
- jiuye.add(new Student("zhangsan1","01"));
- jiuye.add(new Student("zhangsan2","02"));
- yure.add(new Student("lishi1","03"));
- yure.add(new Student("lishi2","04"));
- /*Set<String> set= tr.keySet();
- Iterator<String> it = set.iterator();
- while(it.hasNext())
- {
- String st = it.next();
- Student stu = tr.get(st);
- System.out.println(stu);
- }*/
- }
-
- }
复制代码
谢谢 |
|