Pardon me if it’s simple, but what is the most efficient way to do the following in scala:
Say I have two collections A and B with exactly same number of elements. For example,
A = {objectA1, objectA2, .... objectAN}
B = {objectB1, objectB2, .... objectBN}
I would like to get {{objectA1, objectB1}, {objectA2, objectB2}, ... {objectAN, objectBN}}. Note that these collections might be very large.
Zip them:
Example:
If
AandBare iterators, this will create an iterator of pairs as well.