W3cubDocs

/Kotlin

component1

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

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
}
inline operator fun <T> List<T>.component1(): T
inline operator fun <T> Array<out T>.component1(): T
inline operator fun ByteArray.component1(): Byte
inline operator fun ShortArray.component1(): Short
inline operator fun IntArray.component1(): Int
inline operator fun LongArray.component1(): Long
inline operator fun FloatArray.component1(): Float
inline operator fun DoubleArray.component1(): Double
inline operator fun BooleanArray.component1(): Boolean
inline operator fun CharArray.component1(): Char

Returns 1st element from the collection.

© 2010–2017 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/component1.html