JS stdlib: drop wrong annotations in javautilCollectionsCode.kt and fix Collections.reverse.
This commit is contained in:
@@ -3,30 +3,25 @@ package java.util.Collections
|
|||||||
import java.lang.*
|
import java.lang.*
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
// TODO write tests for empty*
|
||||||
|
|
||||||
// TODO should be immutable!
|
// TODO should be immutable!
|
||||||
library
|
|
||||||
public val emptyList: List<Any> = ArrayList<Any>()
|
public val emptyList: List<Any> = ArrayList<Any>()
|
||||||
library
|
|
||||||
public val emptyMap: Map<Any, Any> = HashMap<Any,Any>()
|
public val emptyMap: Map<Any, Any> = HashMap<Any,Any>()
|
||||||
|
|
||||||
library
|
|
||||||
public val <T> EMPTY_LIST: List<T>
|
public val <T> EMPTY_LIST: List<T>
|
||||||
get() = emptyList<T>()
|
get() = emptyList<T>()
|
||||||
|
|
||||||
library
|
|
||||||
public val <K,V> EMPTY_MAP: Map<K,V>
|
public val <K,V> EMPTY_MAP: Map<K,V>
|
||||||
get() = emptyMap<K,V>()
|
get() = emptyMap<K,V>()
|
||||||
|
|
||||||
library
|
|
||||||
public fun <T> emptyList(): List<T> = emptyList as List<T>
|
public fun <T> emptyList(): List<T> = emptyList as List<T>
|
||||||
library
|
|
||||||
public fun <K,V> emptyMap(): Map<K,V> = emptyMap as Map<K,V>
|
public fun <K,V> emptyMap(): Map<K,V> = emptyMap as Map<K,V>
|
||||||
|
|
||||||
library
|
|
||||||
public fun <T> reverse(list: MutableList<T>): Unit {
|
public fun <T> reverse(list: MutableList<T>): Unit {
|
||||||
val size = list.size()
|
val size = list.size()
|
||||||
for (i in 0.rangeTo(size / 2)) {
|
for (i in 0..(size / 2) - 1) {
|
||||||
val i2 = size - i
|
val i2 = size - i - 1
|
||||||
val tmp = list[i]
|
val tmp = list[i]
|
||||||
list[i] = list[i2]
|
list[i] = list[i2]
|
||||||
list[i2] = tmp
|
list[i2] = tmp
|
||||||
|
|||||||
Reference in New Issue
Block a user