Map<String,Integer> map=new HashMap<String,Integer>();
map.put("jessica",100);
map.put("tom",200);
map.put("den",300);
Set<Map.Entry<String, Integer>> entrySet = map.entrySet();
for (Entry<String, Integer> entry : entrySet) {
System.out.println(entry.getKey()+":"+entry.getValue());
} |