I want to reduce list of tuples that have a common field such as x by summing y fields.
Input:
List(("x" -> "foo", "y" -> 1000),
("x" -> "foo", "y" -> 1),
("x" -> "bar", "y" -> 101))
Output:
List(("x" -> "foo", "y" -> 1001),
("x" -> "bar", "y" -> 101))
What is the good approach for that? foldLeft or reduce?