iterating a map in java code example
Example 1: java for map
Map<String, String> map = new HashMap<>();
for(Entry<String, String> entry:map.entrySet()) {
System.out.println("key: "+entry.getKey()+" value: "+entry.getValue());
}
Example 2: java iterate through map
for (Map.Entry<String, Object> entry : map.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
// ...
}