I read the answers, stating that I can do this effectively:
map.forEach((key, value) -> {
System.out.println("Key : " + key + " Value : " + value);
});
But none of the answers give an example for calculating something in a loop forEach
. For example, if I have Map<String, Integer>
, I would like to know how many values let let say matter 5
. How to do it in a loop forEach
?
source
share