public static void main(String[] args) {
HashMap<String,String> map = new HashMap<String,String>();
map.put("张三", "四川");
map.put("李四", "四川");
map.put("王五", "广东");
map.put("赵六", "北京市");
map.put("钱七", "河北省");
System.out.println(map);
Set<String> set = map.keySet();
for (Iterator<String> it = set.iterator(); it.hasNext();) {
String str = it.next();
System.out.print(str+"==="+map.get(str));
}
System.out.println();
for (String str : set) {
System.out.print(str+"来自"+map.get(str)+",");
}
System.out.println();
Set<Entry<String,String>> entrySet = map.entrySet();
Iterator<Entry<String,String>> entry = entrySet.iterator();
while(entry.hasNext()){
Entry<String,String> en = entry.next();
System.out.print(en.getKey() + "--" + en.getValue());
}
}