Kotlin List – zip() + zipWithNext()
https://grokonez.com/kotlin/kotlin-list-zip-zipwithnext
In the tutorial, we will show how to use zip() and zipWithNext() methods of Kotlin List collection.
I. zip() method
1. zip()
Use below method signatures:
infix fun Iterable.zip(
other: Array
): List>
infix fun Iterable.zip(
other: Iterable
): List>
-> Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
Sample:
More at:
Top comments (0)