Ikem Nwodo
10/07/2018, 10:04 PMDico
10/07/2018, 10:09 PM.withIndex()
is an extension function that associates all elements to their index using a Pair
.
So you get an Iterable<Pair<Int, T>
.Dico
10/07/2018, 10:09 PMPair
is a data class. Which provides component1()
and component2()
functions for its properties in the order they appear in the constructor.Dico
10/07/2018, 10:09 PM(index, element)
is deconstruction syntax, that uses those component functions in the same order.