Indexed
A value of type T paired with an index of type K, i.e. a labelled/positional value.
This is a generalization of the (index, value) pairs produced by, e.g., kotlin.collections.withIndex, generic over the type of the index; see IntIndexed and LongIndexed for the concrete flavours used throughout the codebase (e.g. by Sequence.indexed and Sequence.longIndexed), and destructure it as a pair via component1/component2:
for ((index, value) in sequence.indexed()) { ... }Content copied to clipboard
Type Parameters
K
is the type of the index
T
is the type of the indexed value