HashMap<String, String> emails = new HashMap<String, String>()
//方法一: 用entrySet()
Iterator it = emails.entrySet().iterator()
while(it.hasNext()){
Map.Entry m=(Map.Entry)it.next()
System.out.println("email-" + m.getKey() + ":" + m.getValue())
}
// 方法二:直接再循环中
for (Map.Entry<String, String> m : emails.entrySet())
{
System.out.println("email-" + m.getKey() + ":" + m.getValue())
}
// 方法三:用keySet()
Iterator it = emails.keySet().iterator()
while (it.hasNext()){
String key=(String)it.next()
System.out.println("email-" + key + ":" + emails.get(key))