How to iterate throug a map in Java

To iterate throug a map in Java you can use the snippet below.

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

Please Share us:
Please rate this snippet

6 thoughts on “How to iterate throug a map in Java

Leave a Reply