traverse a map - Java

Map map = ...;

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

for (Object value : map.values()) {
    // ...
}

for (Map.Entry entry : map.entrySet()) {
    String key = entry.getKey();
    Object value = entry.getValue();
    // ...
}

你可能感兴趣的:(traverse a map - Java)