component1

inline operator fun <K, V> Map.Entry<K, V>.component1(): K(source)

Returns the key component of the map entry.

This method allows to use destructuring declarations when working with maps, for example:

for ((key, value) in map) {
// do something with the key and the value
}

Since Kotlin

1.1
inline operator fun <K, V> Map.Entry<K, V>.component1(): K(source)

Returns the key component of the map entry.

This method allows to use destructuring declarations when working with maps, for example:

for ((key, value) in map) {
// do something with the key and the value
}

Since Kotlin

1.0

inline operator fun <T> Array<out T>.component1(): T(source)
inline operator fun ByteArray.component1(): Byte(source)
inline operator fun ShortArray.component1(): Short(source)
inline operator fun IntArray.component1(): Int(source)
inline operator fun LongArray.component1(): Long(source)
inline operator fun FloatArray.component1(): Float(source)
inline operator fun DoubleArray.component1(): Double(source)
inline operator fun BooleanArray.component1(): Boolean(source)
inline operator fun CharArray.component1(): Char(source)

Returns 1st element from the array.

If the size of this array is less than 1, throws an IndexOutOfBoundsException except in Kotlin/JS where the behavior is unspecified.

Since Kotlin

1.0

inline operator fun <T> List<T>.component1(): T(source)

Returns 1st element from the list.

Throws an IndexOutOfBoundsException if the size of this list is less than 1.

Since Kotlin

1.0