Skip to content

Instantly share code, notes, and snippets.

@adilakhter
Created April 9, 2014 12:50
Embed
What would you like to do?
coalesce
def coalesce(x:List[String], y:List[Int]):List[(String, Int)] =
(x zip y).groupBy(_._1)
.values
.map{_.reduce((i,j) => (i._1, (i._2 + j._2)))}
.toList
.sorted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment