Title: Zip Together Two Lists
Slug: zip_together_two_lists
Summary: Zip Together Two Lists Using Scala.
Date: 2017-01-03 12:00
Category: Scala
Tags: Basics
Authors: Chris Albon
If you want to learn more, check out Scala Cookbook and Programming in Scala.
In [1]:
// Create two vectors
val firstName = Vector("Steve", "Bob", "Jack", "Jill")
val lastName = Vector("Jackson", "Dillan", "Bower", "Stein")
In [2]:
// Create a new variable that zips the sequences
val fullNames = firstName zip lastName
In [3]:
// View the zipped sequences and convert to a map
fullNames
Out[3]: