component2

Common
JVM
JS
Native
1.0
operator fun <T> Array<out T>.component2(): T
operator fun ByteArray.component2(): Byte
operator fun ShortArray.component2(): Short
operator fun IntArray.component2(): Int
operator fun LongArray.component2(): Long
operator fun FloatArray.component2(): Float
operator fun DoubleArray.component2(): Double
operator fun BooleanArray.component2(): Boolean
operator fun CharArray.component2(): Char
operator fun <T> List<T>.component2(): T

Returns 2nd element from the collection.

Common
JVM
JS
Native
1.0
operator fun <K, V> Entry<K, V>.component2(): V

Returns the value 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
}