package Mapmapmao;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
public class MapDuiXiang {
/**
* @param args
*/
public static void main(String[] args) {
HashMap<String, HashMap<String,String>> xuexiao=new HashMap<String, HashMap<String,String>>();
HashMap<String,String> yr=new HashMap<String, String>();
HashMap<String,String> jy=new HashMap<String, String>();
xuexiao.put("yurenban",yr);
yr.put("01","zhang1");
yr.put("02","zhang2");
xuexiao.put("jiuye", jy);
jy.put("1","zhang11111");
jy.put("2","zhang22222");
Set<String> st=xuexiao.keySet();
Iterator<String> it=st.iterator();
while(it.hasNext())
{
String s=it.next();
HashMap<String,String> hs=xuexiao.get(s);
System.out.println(s);
pp(hs);
}
}
public static void pp(HashMap<String,String> map)
{
Set<String> st=map.keySet();
Iterator<String> it=st.iterator();
while(it.hasNext())
{
String key=it.next();
String value=map.get(key);
System.out.println(key+" "+value);
}
}
}
/*
* 为什么输出结果是这样的
jiuye
2 zhang22222
1 zhang11111
yurenban
01 zhang1
02 zhang2
先存的是yurenban 结果后打印出来
后存的是jiuye 现打印出来 而且就业班的顺序也不对
* */
|
|