I am trying to simply print all key/value pair(s) in a ConcurrentHashMap.
I found this code online that I thought would do it, but it seems to be getting information ab
The HashMap has forEach as part of its structure. You can use that with a lambda expression to print out the contents in a one liner such as:
forEach
map.forEach((k,v)-> System.out.println(k+", "+v)); or map.forEach((k,v)-> System.out.println("key: "+k+", value: "+v));