How to iterate through a Map[B,Int] in Scala
I have a Map[B,Int] that I am trying to iterate over: So I do something like:
map foreach { case (k,v) => println(k + " " + v)}
However I keep getting the error that there is a type mismatch: Found:
Unit Expected: B
I have read several times on different tutorials that traversing a map is
always the same regardless of what type is point to another.
I am not sure how to fix this.
No comments:
Post a Comment