W3cubDocs

/Kotlin

zip

infix fun <T, R> Sequence<T>.zip(
    other: Sequence<R>
): Sequence<Pair<T, R>>

Returns a sequence of pairs built from elements of both sequences with same indexes. Resulting sequence has length of shortest input sequence.

The operation is intermediate and stateless.

fun <T, R, V> Sequence<T>.zip(
    other: Sequence<R>, 
    transform: (a: T, b: R) -> V
): Sequence<V>

Returns a sequence of values built from elements of both collections with same indexes using provided transform. Resulting sequence has length of shortest input sequences.

The operation is intermediate and stateless.

© 2010–2017 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.sequences/zip.html