JS: drop Collections.reverse and java.util.Collections altogether
This commit is contained in:
@@ -61,3 +61,17 @@ public fun <T> MutableList<T>.sortWith(comparator: Comparator<in T>): Unit {
|
||||
|
||||
@library("collectionsSort")
|
||||
private fun <T> collectionsSort(list: MutableList<T>, comparator: Comparator<in T>): Unit = noImpl
|
||||
|
||||
|
||||
/**
|
||||
* Reverses elements in the list in-place.
|
||||
*/
|
||||
public fun <T> MutableList<T>.reverse(): Unit {
|
||||
val size = this.size
|
||||
for (i in 0..(size / 2) - 1) {
|
||||
val i2 = size - i - 1
|
||||
val tmp = this[i]
|
||||
this[i] = this[i2]
|
||||
this[i2] = tmp
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
package java.util
|
||||
|
||||
public object Collections {
|
||||
@Deprecated("Use list.reverse() instead.", ReplaceWith("list.reverse()"))
|
||||
public fun <T> reverse(list: MutableList<T>): Unit {
|
||||
val size = list.size
|
||||
for (i in 0..(size / 2) - 1) {
|
||||
val i2 = size - i - 1
|
||||
val tmp = list[i]
|
||||
list[i] = list[i2]
|
||||
list[i2] = tmp
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user