DEV Community


Kotlin List – zip() + zipWithNext()

Software Engineer - Founder at
・1 min read

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
    other: Array
): List>
infix fun
    other: Iterable
): List>

-> Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.


More at:

Discussion (0)

Forem Open with the Forem app