In Scala I can write something like this:
val a = List(1, 2, 3)
val b = List(4, 5)
println(a zip b)
That would produce List((1,4), (2,5)) as output.
Now I have two collections in Groovy and want to zip them in similar fashion. What is the simplest way to do this?
Groovy’s equivalent of Scala’s
zipisList#transpose, which can be called on a list of lists: