W3cubDocs

/Kotlin

component2

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

Returns 2nd element from the collection.

inline 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
}

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