zipWithNext

Returns a sequence of pairs of each two adjacent elements in this sequence.

The returned sequence is empty if this sequence contains less than two elements.

The operation is intermediate and stateless.

Since Kotlin

1.2

Samples


fun <T, R> Sequence<T>.zipWithNext(transform: (a: T, b: T) -> R): Sequence<R>(source)

Returns a sequence containing the results of applying the given transform function to an each pair of two adjacent elements in this sequence.

The returned sequence is empty if this sequence contains less than two elements.

The operation is intermediate and stateless.

Since Kotlin

1.2

Samples