Reputation: 261
Let's say I have a following Map:
Map((1,2,3) -> List(4, 5))
And now I would like to transform it to:
(1,2,3,List(4, 5))
How to do this functional way?
Upvotes: 1
Views: 636
Reputation: 3921
val myMap = Map((1, 2, 3) -> List(4, 5))
val tuple = myMap map { case ((a, b, c), list) => (a, b, c, list) }
This will return you Iterable[(Int, Int, Int, List[Int])]
, that is an Iterable
of your tuple
s of 1, 2, 3, List(4, 5)
... If that's what you need.
Upvotes: 4