In-place array sorting in JS.
This commit is contained in:
@@ -489,6 +489,132 @@ public inline fun ShortArray.plus(element: Short): ShortArray {
|
||||
return (this: dynamic).concat(arrayOf(element))
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the array inplace.
|
||||
*/
|
||||
library("primitiveArraySort")
|
||||
public fun ByteArray.sort(): Unit {
|
||||
return noImpl
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the array inplace.
|
||||
*/
|
||||
library("primitiveArraySort")
|
||||
public fun CharArray.sort(): Unit {
|
||||
return noImpl
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the array inplace.
|
||||
*/
|
||||
library("primitiveArraySort")
|
||||
public fun DoubleArray.sort(): Unit {
|
||||
return noImpl
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the array inplace.
|
||||
*/
|
||||
library("primitiveArraySort")
|
||||
public fun FloatArray.sort(): Unit {
|
||||
return noImpl
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the array inplace.
|
||||
*/
|
||||
library("primitiveArraySort")
|
||||
public fun IntArray.sort(): Unit {
|
||||
return noImpl
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the array inplace.
|
||||
*/
|
||||
library("primitiveArraySort")
|
||||
public fun ShortArray.sort(): Unit {
|
||||
return noImpl
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the array inplace.
|
||||
*/
|
||||
public fun <T: Comparable<T>> Array<out T>.sort(): Unit {
|
||||
sort { a: T, b: T -> a.compareTo(b) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the array inplace.
|
||||
*/
|
||||
public fun LongArray.sort(): Unit {
|
||||
sort { a: Long, b: Long -> a.compareTo(b) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the array inplace according to the order specified by the given [comparison] function.
|
||||
*/
|
||||
native
|
||||
public fun <T> Array<out T>.sort(comparison: (T, T) -> Int): Unit {
|
||||
return noImpl
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the array inplace according to the order specified by the given [comparison] function.
|
||||
*/
|
||||
native
|
||||
public fun ByteArray.sort(comparison: (Byte, Byte) -> Int): Unit {
|
||||
return noImpl
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the array inplace according to the order specified by the given [comparison] function.
|
||||
*/
|
||||
native
|
||||
public fun CharArray.sort(comparison: (Char, Char) -> Int): Unit {
|
||||
return noImpl
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the array inplace according to the order specified by the given [comparison] function.
|
||||
*/
|
||||
native
|
||||
public fun DoubleArray.sort(comparison: (Double, Double) -> Int): Unit {
|
||||
return noImpl
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the array inplace according to the order specified by the given [comparison] function.
|
||||
*/
|
||||
native
|
||||
public fun FloatArray.sort(comparison: (Float, Float) -> Int): Unit {
|
||||
return noImpl
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the array inplace according to the order specified by the given [comparison] function.
|
||||
*/
|
||||
native
|
||||
public fun IntArray.sort(comparison: (Int, Int) -> Int): Unit {
|
||||
return noImpl
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the array inplace according to the order specified by the given [comparison] function.
|
||||
*/
|
||||
native
|
||||
public fun LongArray.sort(comparison: (Long, Long) -> Int): Unit {
|
||||
return noImpl
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the array inplace according to the order specified by the given [comparison] function.
|
||||
*/
|
||||
native
|
||||
public fun ShortArray.sort(comparison: (Short, Short) -> Int): Unit {
|
||||
return noImpl
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a *typed* object array containing all of the elements of this primitive array.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user