zipWithNext
Returns a list of pairs of each two adjacent elements in this collection.
fun <T> Iterable<T>.zipWithNext(): List<Pair<T, T>>(source)
val numbers = listOf(10, 20, 30, 40, 50)
val adjacentPairs = numbers.zipWithNext() // [(10, 20), (20, 30), (30, 40), (40, 50)]
println(adjacentPairs)