Kotlin HashSet zip()
Syntax & Examples


Syntax of HashSet.zip()

There are 4 variations for the syntax of HashSet.zip() extension function. They are:

1.
infix fun <T, R> Iterable<T>.zip( other: Array<out R> ): List<Pair<T, R>>

This extension function returns a list of pairs built from the elements of this collection and the other array with the same index. The returned list has length of the shortest collection.

2.
fun <T, R, V> Iterable<T>.zip( other: Array<out R>, transform: (a: T, b: R) -> V ): List<V>

This extension function returns a list of values built from the elements of this collection and the other array with the same index using the provided transform function applied to each pair of elements. The returned list has length of the shortest collection.

3.
infix fun <T, R> Iterable<T>.zip( other: Iterable<R> ): List<Pair<T, R>>

This extension function returns a list of pairs built from the elements of this collection and other collection with the same index. The returned list has length of the shortest collection.

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

This extension function returns a list of values built from the elements of this collection and the other collection with the same index using the provided transform function applied to each pair of elements. The returned list has length of the shortest collection.