Skip to content

Instantly share code, notes, and snippets.

@mbchoa
Created March 6, 2015 18:55
Show Gist options
  • Save mbchoa/fe18a8a482d47b592456 to your computer and use it in GitHub Desktop.
Save mbchoa/fe18a8a482d47b592456 to your computer and use it in GitHub Desktop.
Iterating through a Java Map
for (Map.Entry<String, String> entry : map.entrySet())
{
System.out.println(entry.getKey() + "/" + entry.getValue());
}
Iterator<Map.Entry<String, String>> entries = myMap.entrySet().iterator();
while (entries.hasNext()) {
Map.Entry<String, String> entry = entries.next();
String key = entry.getKey();
String value = entry.getValue();
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment