def isIntIntMap(x: Any) = x match { case m: Map[Int, Int] => true case _ => false } <console>:5: warning: non variable type-argument Int in type pattern is unchecked since it is eliminated by erasure case m: Map[Int, Int] => true ˆ
Scalausestheerasuremodelofgenerics,justlikeJavadoes.
Thismeans that no information about type arguments is maintained at runtime.
Consequently, there is no way to determine at runtime whether a given Map object has beencreatedwithtwo Int arguments,ratherthanwithargumentsofdifferent types.
All the system can do is determine that a value is a Map of some arbitrary type parameters.