toTypedArray

actual fun ByteArray.toTypedArray(): Array<Byte> (source)
actual fun ShortArray.toTypedArray(): Array<Short> (source)
actual fun IntArray.toTypedArray(): Array<Int> (source)
actual fun LongArray.toTypedArray(): Array<Long> (source)
actual fun FloatArray.toTypedArray(): Array<Float> (source)
actual fun DoubleArray.toTypedArray(): Array<Double> (source)
actual fun BooleanArray.toTypedArray(): Array<Boolean> (source)
actual fun CharArray.toTypedArray(): Array<Char> (source)

Returns a typed object array containing all of the elements of this primitive array.

inline actual fun <reified T> Collection<T>.toTypedArray(): Array<T> (source)

Returns a typed array containing all of 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.

import kotlin.test.*

fun main(args: Array<String>) {
//sampleStart
val collection = listOf(1, 2, 3)
val array = collection.toTypedArray()
println(array.contentToString()) // [1, 2, 3]
//sampleEnd
}