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 is that if I use toMap() directly, values ββwith the same keys are deleted.
History so far:
list.groupBy(el => el).map(el => el._1 -> ?)
source share