Created
July 5, 2016 19:23
-
-
Save rvandervort/fbdff825abd372e7c9f7a55e590c1184 to your computer and use it in GitHub Desktop.
Scala -- given two maps with identical keys, return a map that contains the keys and tuple of values from both maps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type TheMap: Map[String, String] | |
// a and b really should have the same keys | |
// If not, entries from b will be lost. | |
def zipToTuples(a: TheMap, b: TheMap) = | |
(a.keys zip (a.values zip b.values)).toMap |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment