I got the following list of pairs:
List(("US","New York"),("England","London"),("US","Los Angeles"),("England","Manchester"),("US","Washington"))
I need to generate a Map[Country, List[Cities]]:
Map("US" -> List("New York", "Los Angeles", "Washington"), "England" -> List("London", "Manchester"))
The problem that if I use toMap() directly the values with same keys are removed.
The story so far:
list.groupBy(el => el).map(el => el._1 -> ?)