Skip to content

Instantly share code, notes, and snippets.

@rvandervort
Created July 5, 2016 19:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rvandervort/fbdff825abd372e7c9f7a55e590c1184 to your computer and use it in GitHub Desktop.
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
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