I have 3 lists like
val a = List("a", "b", "c")
val b = List(1, 2, 3)
val c = List(4, 5, 6)
I want convert them as follows
List(("a", 1, 4), ("b", 2, 5), ("c", 3, 6))
Please let me know how to get this result
If you have two or three lists that you need zipped together you can use zipped
val a = List("a", "b", "c")
val b = List(1, 2, 3)
val c = List(4, 5, 6)
(a,b,c).zipped.toList
This results in: List((a,1,4), (b,2,5), (c,3,6))
Should be easy to achieve:
(a zip b) zip c map {
case ((x, y), z) => (x, y, z)
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With