//遍历key
for (String key : dic.keySet()
) {
System.out.println(key + dic.get(key));
}
//遍历values
for (String value : dic.values()
) {
System.out.println(value);
}
//使用entry遍历键值对
for (Map.Entry<String,String> entry:dic.entrySet()
) {
System.out.println(entry.getKey()+":"+entry.getValue());
} //用迭代器遍历
Iterator<Map.Entry<String,String>> itor = dic.entrySet().iterator();
while (itor.hasNext())
{
Map.Entry<String,String> entry = itor.next();
System.out.println(entry.getKey()+""+entry.getValue());
}