component2
operator fun ByteArray.component2(): Byteoperator fun ShortArray.component2(): Shortoperator fun IntArray.component2(): Intoperator fun LongArray.component2(): Longoperator fun FloatArray.component2(): Floatoperator fun DoubleArray.component2(): Doubleoperator fun BooleanArray.component2(): Booleanoperator fun CharArray.component2(): Char@ExperimentalUnsignedTypes operator fun ULongArray.component2(): ULong@ExperimentalUnsignedTypes operator fun UByteArray.component2(): UByte@ExperimentalUnsignedTypes operator fun UShortArray.component2(): UShortReturns 2nd element from the array.
If the size of this array is less than 2, throws an IndexOutOfBoundsException except in Kotlin/JS where the behavior is unspecified.
operator fun <T> List<T>.component2(): TReturns 2nd element from the list.
Throws an IndexOutOfBoundsException if the size of this list is less than 2.
operator fun <K, V> Entry<K, V>.component2(): VReturns 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
}