print map string object code example
Example 1: print map java
map.forEach((key, value) -> System.out.println(key + ":" + value));
Example 2: print elements in map java
// Java 8 - Collection.iterator() + Iterator.forEachRemaining()
map.keySet().iterator()
.forEachRemaining(System.out::println);