I have list1 that I need to associate to list2 one...
# getting-started
d
I have list1 that I need to associate to list2 one-to-one, is there an ideomatic way to do this?
s
zip()
d
Thanks!
What if I want specific indices of list2? So far I have:
deviceSpecs.zip(listOf(1, 1, -1, 2, 4, 3, 0))
but then I need to use
val elem2 = list2.getOrNull(it.second)
....
s
`map()`/`mapIndexed()` maybe ?
d
I guess zip is better in this case, since I need to generate test data, and anyways need to declare
listOf(1, 1, -1, 2, 4, 3, 0)
... it's not part of the fixtures, just the valid values...
But thanks anyways, I'll keep those in mind for other cases too!
s
np