I have a list:
List[Any]("foo", 1, 2, "bar", 3, 4, 5)
I would like to group it's elements this way:
Map("foo" -> List(1,2), "bar" -> List(3,4,5))
I can only imagine a solution in an imperative style with mutable lists and vars, but what is the proper way of solving this task?