Skip to content

Instantly share code, notes, and snippets.

@krishnanraman
Created January 16, 2013 23:09
Show Gist options
  • Save krishnanraman/4551886 to your computer and use it in GitHub Desktop.
Save krishnanraman/4551886 to your computer and use it in GitHub Desktop.
First key that maps to a value in a scala map
scala> val m = Map(1->"one",2->"one",3->"two")
scala> m.filter(pair=>pair._2 == "one").head._1
res32: Int = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment