IntIndexed

An Indexed value whose index is an Int, comparable to other IntIndexed values by index. This is the type produced by Sequence.indexed, the "counted" counterpart of kotlin.collections.withIndex used throughout the codebase whenever a position needs to travel along with a value through further transformations (e.g. .map { it.map(...) }), which a plain IndexedValue/destructured pair would not allow as conveniently.

Type Parameters

T

is the type of the indexed value

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val index: Int

The index/position associated with value.

Link copied to clipboard
abstract val value: T

The indexed value.

Functions

Link copied to clipboard
open operator override fun compareTo(other: IntIndexed<T>): Int

Compares two IntIndexed values by their index, ignoring value.

Link copied to clipboard
open operator fun component1(): Int

Destructuring component corresponding to index.

Link copied to clipboard
open operator fun component2(): T

Destructuring component corresponding to value.

Link copied to clipboard
abstract override fun <R> map(mapper: (T) -> R): IntIndexed<R>

Returns a new IntIndexed with the same index, and value transformed via mapper.