Skip to content

Instantly share code, notes, and snippets.

@seratch
Created May 30, 2011 07:52
Show Gist options
  • Save seratch/998577 to your computer and use it in GitHub Desktop.
Save seratch/998577 to your computer and use it in GitHub Desktop.
yield tuples from List of tuples or Map
scala> for { (k,v) <- List((1,2),(3,4)) } yield (k,v)
res0: List[(Int, Int)] = List((1,2), (3,4))
scala> for { (k,v) <- List((1,2),(3,4)).toMap } yield (k,v)
res1: scala.collection.immutable.Map[Int,Int] = Map(1 -> 2, 3 -> 4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment