What is an elegant way to iterate over two collections in Scala using a single loop?
I want the values ββfrom the first collection to be second, for example:
// pseudo-code for (i <- 1 to 10) { val value = collection1.get(i); collection2.setValueAtIndex(value, i) ; }
I actually use the Iterable trait, so itβs better if you provide a solution that is applicable to Iterable .
Please note: I do not want to copy values ββfrom one to another. I need to access the i'th element of the first and second collection in a loop Thanks.
source share