Rename copyToArrayImpl to collectionToArray
This commit is contained in:
committed by
Space Team
parent
7010bf2c20
commit
7fc90c02f1
@@ -33,9 +33,9 @@ expect fun <T> MutableList<T>.sortWith(comparator: Comparator<in T>): Unit
|
||||
public expect fun <T, K> Grouping<T, K>.eachCount(): Map<K, Int>
|
||||
// public expect inline fun <T, K> Grouping<T, K>.eachSumOf(valueSelector: (T) -> Int): Map<K, Int>
|
||||
|
||||
internal expect fun copyToArrayImpl(collection: Collection<*>): Array<Any?>
|
||||
internal expect fun collectionToArray(collection: Collection<*>): Array<Any?>
|
||||
|
||||
internal expect fun <T> copyToArrayImpl(collection: Collection<*>, array: Array<T>): Array<T>
|
||||
internal expect fun <T> collectionToArray(collection: Collection<*>, array: Array<T>): Array<T>
|
||||
|
||||
internal expect fun <T> arrayOfNulls(reference: Array<T>, size: Int): Array<T>
|
||||
internal expect fun <K, V> Map<K, V>.toSingletonMapOrSelf(): Map<K, V>
|
||||
|
||||
@@ -32,14 +32,12 @@ internal fun <T> copyToArray(collection: Collection<T>): Array<T> {
|
||||
return if (collection.asDynamic().toArray !== undefined)
|
||||
collection.asDynamic().toArray().unsafeCast<Array<T>>()
|
||||
else
|
||||
copyToArrayImpl(collection).unsafeCast<Array<T>>()
|
||||
collectionToArray(collection).unsafeCast<Array<T>>()
|
||||
}
|
||||
|
||||
@JsName("copyToArrayImpl")
|
||||
internal actual fun copyToArrayImpl(collection: Collection<*>): Array<Any?> = collectionToArrayCommonImpl(collection)
|
||||
internal actual fun collectionToArray(collection: Collection<*>): Array<Any?> = collectionToArrayCommonImpl(collection)
|
||||
|
||||
@JsName("copyToExistingArrayImpl")
|
||||
internal actual fun <T> copyToArrayImpl(collection: Collection<*>, array: Array<T>): Array<T> = collectionToArrayCommonImpl(collection, array)
|
||||
internal actual fun <T> collectionToArray(collection: Collection<*>, array: Array<T>): Array<T> = collectionToArrayCommonImpl(collection, array)
|
||||
|
||||
internal actual fun <T> terminateCollectionToArray(collectionSize: Int, array: Array<T>): Array<T> = array
|
||||
|
||||
|
||||
@@ -77,12 +77,12 @@ public fun <T> Iterable<T>.shuffled(random: java.util.Random): List<T> = toMutab
|
||||
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
internal actual inline fun copyToArrayImpl(collection: Collection<*>): Array<Any?> =
|
||||
internal actual inline fun collectionToArray(collection: Collection<*>): Array<Any?> =
|
||||
kotlin.jvm.internal.collectionToArray(collection)
|
||||
|
||||
@kotlin.internal.InlineOnly
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
internal actual inline fun <T> copyToArrayImpl(collection: Collection<*>, array: Array<T>): Array<T> =
|
||||
internal actual inline fun <T> collectionToArray(collection: Collection<*>, array: Array<T>): Array<T> =
|
||||
kotlin.jvm.internal.collectionToArray(collection, array as Array<Any?>) as Array<T>
|
||||
|
||||
internal actual fun <T> terminateCollectionToArray(collectionSize: Int, array: Array<T>): Array<T> {
|
||||
|
||||
@@ -84,9 +84,9 @@ internal fun <T> Array<out T>?.contentDeepHashCodeImpl(): Int {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
internal actual fun <T> arrayOfNulls(reference: Array<T>, size: Int): Array<T> = arrayOfNulls<Any>(size) as Array<T>
|
||||
|
||||
internal actual fun copyToArrayImpl(collection: Collection<*>): Array<Any?> = collectionToArrayCommonImpl(collection)
|
||||
internal actual fun collectionToArray(collection: Collection<*>): Array<Any?> = collectionToArrayCommonImpl(collection)
|
||||
|
||||
internal actual fun <T> copyToArrayImpl(collection: Collection<*>, array: Array<T>): Array<T> = collectionToArrayCommonImpl(collection, array)
|
||||
internal actual fun <T> collectionToArray(collection: Collection<*>, array: Array<T>): Array<T> = collectionToArrayCommonImpl(collection, array)
|
||||
|
||||
internal actual fun <T> terminateCollectionToArray(collectionSize: Int, array: Array<T>): Array<T> = array
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public abstract class AbstractCollection<out E> protected constructor() : Collec
|
||||
* Returns new array of type `Array<Any?>` with the elements of this collection.
|
||||
*/
|
||||
@JsName("toArray")
|
||||
protected open fun toArray(): Array<Any?> = copyToArrayImpl(this)
|
||||
protected open fun toArray(): Array<Any?> = collectionToArray(this)
|
||||
|
||||
/**
|
||||
* Fills the provided [array] or creates new array of the same type
|
||||
@@ -45,5 +45,5 @@ public abstract class AbstractCollection<out E> protected constructor() : Collec
|
||||
*
|
||||
* @return An array containing all elements of this collection.
|
||||
*/
|
||||
protected open fun <T> toArray(array: Array<T>): Array<T> = copyToArrayImpl(this, array)
|
||||
protected open fun <T> toArray(array: Array<T>): Array<T> = collectionToArray(this, array)
|
||||
}
|
||||
|
||||
@@ -22,4 +22,4 @@ internal fun <T> copyToArray(collection: Collection<T>): Array<T> =
|
||||
//TODO: Find more proper way to call abstract collection's toArray
|
||||
@Suppress("INVISIBLE_MEMBER") collection.toArray() as Array<T>
|
||||
else
|
||||
copyToArrayImpl(collection) as Array<T>
|
||||
collectionToArray(collection) as Array<T>
|
||||
Reference in New Issue
Block a user