Suppose I have a map m: Map[Any, Int]
. Now I would like to take only entries (String, Int)
from m
and create a new map m1: Map[String, Int]
with those entries.
I am trying to do the following:
val m1: Map[String, Int] = m collect {case e:(String, Int) => e}
It seems working but I get a warning: non variable type-argument String in type pattern (String, Int) is unchecked since it is eliminated by erasure.
How can I get rid of the warning?