package map;
import java.util.HashMap;
import java.util.Map;
import bean.Student;
public class Test6 {
public static void main(String[] args) {
HashMap<Student, String> hm = new HashMap<Student, String>();
hm.put(new Student("张三", 23), "北京");
hm.put(new Student("李四", 24), "上海");
hm.put(new Student("王五", 25), "韩国");
hm.put(new Student("周六", 26), "法国");
HashMap<Student, String> hm1 = new HashMap<Student, String>();
hm1.put(new Student("高芹", 22), "山东");
hm1.put(new Student("高博", 24), "上海");
hm1.put(new Student("高飞", 22), "日本");
hm1.put(new Student("豆豆", 20), "意大利");
HashMap<HashMap<Student, String>, String> list = new HashMap<>();
list.put(hm, "第一期");
list.put(hm1, "第二期");
// System.out.println(list);
for (HashMap<Student, String> s : list.keySet()) {
String value = list.get(s);
for (Student ss : s.keySet()) {
String value2 = s.get(ss);
System.out.println(ss + "=" + value2 + "=" + value);
}
}
}
}
|
|