Use empty array instead of presized for Collection.toArray
#KT-21918
This commit is contained in:
@@ -47,7 +47,7 @@ public inline fun ByteArray.toString(charset: Charset): String = String(this, ch
|
||||
public inline fun <reified T> Collection<T>.toTypedArray(): Array<T> {
|
||||
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
|
||||
val thisCollection = this as java.util.Collection<T>
|
||||
return thisCollection.toArray(arrayOfNulls<T>(thisCollection.size())) as Array<T>
|
||||
return thisCollection.toArray(arrayOfNulls<T>(0)) as Array<T>
|
||||
}
|
||||
|
||||
/** Internal unsafe construction of array based on reference array type */
|
||||
|
||||
Reference in New Issue
Block a user