4035
Example of using iterator and generics:
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();
// ...
}
The correct way to do this is to use the accepted answer as it is the most efficient. I find the following code looks a bit cleaner.
for (String key: map.keySet()) {
System.out.println(key + "/" + map.get(key));
}