copyOf (original) (raw)

Returns new array which is a copy of the original array.

Since Kotlin

1.3

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "limes")
val arrayCopy = array.copyOf()
println(arrayCopy.contentToString()) // [apples, oranges, limes] 
   //sampleEnd
}

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with zero values if necessary.

Since Kotlin

1.3


Returns new array which is a copy of the original array.

Since Kotlin

1.0

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "limes")
val arrayCopy = array.copyOf()
println(arrayCopy.contentToString()) // [apples, oranges, limes] 
   //sampleEnd
}

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with null values if necessary.

Since Kotlin

1.0

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "limes")
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [apples, oranges, limes, null, null]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [apples, oranges] 
   //sampleEnd
}

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with zero values if necessary.

Since Kotlin

1.0

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with false values if necessary.

Since Kotlin

1.0

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with null char (\u0000) values if necessary.

Since Kotlin

1.0

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

Returns new array which is a copy of the original array.

Since Kotlin

1.1

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "limes")
val arrayCopy = array.copyOf()
println(arrayCopy.contentToString()) // [apples, oranges, limes] 
   //sampleEnd
}

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with null values if necessary.

Since Kotlin

1.1


Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with zero values if necessary.

Since Kotlin

1.1

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with false values if necessary.

Since Kotlin

1.1

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with null char (\u0000) values if necessary.

Since Kotlin

1.1

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

Returns new array which is a copy of the original array.

Since Kotlin

1.0

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "limes")
val arrayCopy = array.copyOf()
println(arrayCopy.contentToString()) // [apples, oranges, limes] 
   //sampleEnd
}

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with null values if necessary.

Since Kotlin

1.0

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "limes")
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [apples, oranges, limes, null, null]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [apples, oranges] 
   //sampleEnd
}

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with zero values if necessary.

Since Kotlin

1.0

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with false values if necessary.

Since Kotlin

1.0

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with null char (\u0000) values if necessary.

Since Kotlin

1.0

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

Returns new array which is a copy of the original array.

Since Kotlin

1.3

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "limes")
val arrayCopy = array.copyOf()
println(arrayCopy.contentToString()) // [apples, oranges, limes] 
   //sampleEnd
}

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with null values if necessary.

Since Kotlin

1.3

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "limes")
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [apples, oranges, limes, null, null]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [apples, oranges] 
   //sampleEnd
}

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with zero values if necessary.

Since Kotlin

1.3

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with false values if necessary.

Since Kotlin

1.3

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with null char (\u0000) values if necessary.

Since Kotlin

1.3

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

Returns new array which is a copy of the original array.

Since Kotlin

1.8

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "limes")
val arrayCopy = array.copyOf()
println(arrayCopy.contentToString()) // [apples, oranges, limes] 
   //sampleEnd
}

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with null values if necessary.

Since Kotlin

1.8

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "limes")
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [apples, oranges, limes, null, null]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [apples, oranges] 
   //sampleEnd
}

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with zero values if necessary.

Since Kotlin

1.8

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with false values if necessary.

Since Kotlin

1.8

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with null char (\u0000) values if necessary.

Since Kotlin

1.8

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

Returns new array which is a copy of the original array.

Since Kotlin

1.8

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "limes")
val arrayCopy = array.copyOf()
println(arrayCopy.contentToString()) // [apples, oranges, limes] 
   //sampleEnd
}

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with null values if necessary.

Since Kotlin

1.8

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = arrayOf("apples", "oranges", "limes")
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [apples, oranges, limes, null, null]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [apples, oranges] 
   //sampleEnd
}

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with zero values if necessary.

Since Kotlin

1.8

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with false values if necessary.

Since Kotlin

1.8

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}

Returns new array which is a copy of the original array, resized to the given newSize. The copy is either truncated or padded at the end with null char (\u0000) values if necessary.

Since Kotlin

1.8

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val array = intArrayOf(1, 2, 3)
val arrayCopyPadded = array.copyOf(5)
println(arrayCopyPadded.contentToString()) // [1, 2, 3, 0, 0]
val arrayCopyTruncated = array.copyOf(2)
println(arrayCopyTruncated.contentToString()) // [1, 2] 
   //sampleEnd
}