Created
February 8, 2012 04:15
-
-
Save paulfryzel/1765396 to your computer and use it in GitHub Desktop.
JavaConversions confusion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> val m = Map(1 -> 2) | |
m: scala.collection.immutable.Map[Int,Int] = Map(1 -> 2) | |
scala> m.get("1") | |
<console>:9: error: type mismatch; | |
found : java.lang.String("1") | |
required: Int | |
m.get("1") | |
^ | |
scala> import scala.collection.JavaConversions._ | |
import scala.collection.JavaConversions._ | |
scala> m.get("1") | |
res1: Int = 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment