entrySet遍历key+value(写法1):

Iterator<Entry<String, String>> iter = map.entrySet().iterator();
Entry<String, String> entry;
while (iter.hasNext()) {
    entry = iter.next();
    key = entry.getKey();
    value = entry.getValue();
}

  entrySet遍历key+value(写法2):

for (Entry<String, String> entry: map.entrySet()) {
    key = entry.getKey();
    value = entry.getValue();
}

  2.2.2 遍历key

  keySet遍历key(写法1):

Iterator<String> iter = map.keySet().iterator();
while (iter.hasNext()) {
    key = iter.next();
}

  keySet遍历key(写法2):

for (String key : map.keySet()) {
}

  entrySet遍历key(写法1):

Iterator<Entry<String, String>> iter = map.entrySet().iterator(); 
while (iter.hasNext()) {
    key = iter.next().getKey();
}

  entrySet遍历key(写法2):

for (Entry<String, String> entry: map.entrySet()) {
    key = entry.getKey();
}

  2.2.3 遍历value

  keySet遍历value(写法1):

Iterator<String> iter = map.keySet().iterator();
while (iter.hasNext()) {
    value = map.get(iter.next());
}

  keySet遍历value(写法2):

for (String key : map.keySet()) {
    value = map.get(key);
}

  entrySet遍历value(写法1):

Iterator<Entry<String, String>> iter = map.entrySet().iterator();
while (iter.hasNext()) {
value = iter.next().getValue();
}

  entrySet遍历value(写法2):

for (Entry<String, String> entry: map.entrySet()) {
    value = entry.getValue();
}

  values遍历value(写法1):

Iterator<String> iter = map.values().iterator();
while (iter.hasNext()) {
value = iter.next();
}

  values遍历value(写法2):

for (String value : map.values()) {
}