Kotlin HashSet zipWithNext()
Syntax & Examples


Syntax of HashSet.zipWithNext()

There are 2 variations for the syntax of HashSet.zipWithNext() extension function. They are:

1.
fun <T> Iterable<T>.zipWithNext(): List<Pair<T, T>>

This extension function returns a list of pairs of each two adjacent elements in this collection.

2.
fun <T, R> Iterable<T>.zipWithNext( transform: (a: T, b: T) -> R ): List<R>

This extension function returns a list containing the results of applying the given transform function to an each pair of two adjacent elements in this collection.