toTypedArray
Returns a typed object array containing all of the elements of this primitive array.
Since Kotlin
1.3Returns a typed object array containing all of the elements of this primitive array.
Since Kotlin
1.0Returns a typed array containing all the elements of this collection.
Allocates an array of runtime type T
having its size equal to the size of this collection and populates the array with the elements of this collection.
Since Kotlin
1.0Samples
import kotlin.test.*
fun main() {
//sampleStart
val collection = listOf(1, 2, 3)
val array = collection.toTypedArray()
println(array.contentToString()) // [1, 2, 3]
//sampleEnd
}
Returns a typed object array containing all of the elements of this primitive array.
Since Kotlin
1.1Returns a typed array containing all the elements of this collection.
Allocates an array of runtime type T
having its size equal to the size of this collection and populates the array with the elements of this collection.
Since Kotlin
1.1Samples
import kotlin.test.*
fun main() {
//sampleStart
val collection = listOf(1, 2, 3)
val array = collection.toTypedArray()
println(array.contentToString()) // [1, 2, 3]
//sampleEnd
}
Returns a typed object array containing all of the elements of this primitive array.
Since Kotlin
1.0Returns a typed array containing all the elements of this collection.
Allocates an array of runtime type T
having its size equal to the size of this collection and populates the array with the elements of this collection.
Since Kotlin
1.0Samples
import kotlin.test.*
fun main() {
//sampleStart
val collection = listOf(1, 2, 3)
val array = collection.toTypedArray()
println(array.contentToString()) // [1, 2, 3]
//sampleEnd
}
Returns a typed object array containing all of the elements of this primitive array.
Since Kotlin
1.3Returns a typed array containing all the elements of this collection.
Allocates an array of runtime type T
having its size equal to the size of this collection and populates the array with the elements of this collection.
Since Kotlin
1.3Samples
import kotlin.test.*
fun main() {
//sampleStart
val collection = listOf(1, 2, 3)
val array = collection.toTypedArray()
println(array.contentToString()) // [1, 2, 3]
//sampleEnd
}
Returns a typed object array containing all of the elements of this primitive array.
Since Kotlin
1.8Returns a typed array containing all the elements of this collection.
Allocates an array of runtime type T
having its size equal to the size of this collection and populates the array with the elements of this collection.
Since Kotlin
1.8Samples
import kotlin.test.*
fun main() {
//sampleStart
val collection = listOf(1, 2, 3)
val array = collection.toTypedArray()
println(array.contentToString()) // [1, 2, 3]
//sampleEnd
}
Returns a typed object array containing all of the elements of this primitive array.
Since Kotlin
1.8Returns a typed array containing all the elements of this collection.
Allocates an array of runtime type T
having its size equal to the size of this collection and populates the array with the elements of this collection.
Since Kotlin
1.8Samples
import kotlin.test.*
fun main() {
//sampleStart
val collection = listOf(1, 2, 3)
val array = collection.toTypedArray()
println(array.contentToString()) // [1, 2, 3]
//sampleEnd
}