Skip to content

Instantly share code, notes, and snippets.

@paulfryzel
Created February 8, 2012 04:15
Show Gist options
  • Save paulfryzel/1765396 to your computer and use it in GitHub Desktop.
Save paulfryzel/1765396 to your computer and use it in GitHub Desktop.
JavaConversions confusion
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