KotlinCollection Opszip
partition

zipCollection Ops

Returns a list of pairs built from the elements of this collection and other collection.

Syntax

listA.zip(listB)

Example

Enter values below to update the example in real time.

val
listOf
println
zip
one
two
three
val a = listOf(1, 2, 3)
val b = listOf("one", "two", "three")
println(a.zip(b)) // [(1, one), (2, two), (3, three)]