Skip to content

Instantly share code, notes, and snippets.

@seratch
Created August 20, 2011 03:19
Show Gist options
  • Save seratch/1158602 to your computer and use it in GitHub Desktop.
Save seratch/1158602 to your computer and use it in GitHub Desktop.
Iterable#zip snippet
val ids = List(1,2,3,4,5)
val names = List("Andy", "Brian", "Kent", "Taro", "John")
ids zip names foreach {
case (id, name) => println("id:" + id + ",name:" + name)
}
// id:1,name:Andy
// id:2,name:Brian
// id:3,name:Kent
// id:4,name:Taro
// id:5,name:John
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment