changed js tests/library after collections mapping
This commit is contained in:
@@ -36,7 +36,7 @@ public object Collections {
|
||||
}
|
||||
|
||||
library
|
||||
public fun <T> reverse(list: List<T>): Unit {
|
||||
public fun <T> reverse(list: MutableList<T>): Unit {
|
||||
val size = list.size()
|
||||
for (i in 0.rangeTo(size / 2)) {
|
||||
val i2 = size - i
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package js
|
||||
|
||||
import java.util.List
|
||||
|
||||
native public fun String.toUpperCase() : String = js.noImpl
|
||||
|
||||
native public fun String.toLowerCase() : String = js.noImpl
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package kotlin
|
||||
|
||||
import java.util.Map
|
||||
import java.util.HashMap
|
||||
|
||||
/** Provides [] access to maps */
|
||||
public fun <K, V> Map<K, V>.set(key : K, value : V): Unit {
|
||||
public fun <K, V> MutableMap<K, V>.set(key : K, value : V): Unit {
|
||||
this.put(key, value)
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ public inline fun <T> Iterable<T>.toString(): String {
|
||||
return makeString(", ", "[", "]")
|
||||
}
|
||||
|
||||
public inline fun <T> java.util.List<T>.equals(that: List<T>): Boolean {
|
||||
public inline fun <T> List<T>.equals(that: List<T>): Boolean {
|
||||
val s1 = this.size()
|
||||
val s2 = that.size()
|
||||
if (s1 == s2) {
|
||||
@@ -45,7 +45,7 @@ public inline fun hashSet<T>(vararg values: T) : HashSet<T> {
|
||||
*
|
||||
* @includeFunctionBody ../../test/CollectionTest.kt map
|
||||
*/
|
||||
public inline fun <K,V,R> java.util.Map<K,V>.map(transform: (java.util.Map.Entry<K,V>) -> R) : java.util.List<R> {
|
||||
public inline fun <K,V,R> Map<K,V>.map(transform: (Map.Entry<K,V>) -> R) : List<R> {
|
||||
return mapTo(java.util.ArrayList<R>(), transform)
|
||||
}
|
||||
|
||||
@@ -55,8 +55,8 @@ public inline fun <K,V,R> java.util.Map<K,V>.map(transform: (java.util.Map.Entry
|
||||
*
|
||||
* @includeFunctionBody ../../test/MapTest.kt mapValues
|
||||
*/
|
||||
public inline fun <K,V,R> java.util.Map<K,V>.mapValues(transform : (java.util.Map.Entry<K,V>) -> R): java.util.Map<K,R> {
|
||||
return mapValuesTo(java.util.HashMap<K,R>(), transform)
|
||||
public inline fun <K,V,R> MutableMap<K,V>.mapValues(transform : (Map.Entry<K,V>) -> R): Map<K,R> {
|
||||
return mapValuesTo(HashMap<K,R>(), transform)
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,6 @@ public inline fun <K,V,R> java.util.Map<K,V>.mapValues(transform : (java.util.Ma
|
||||
*
|
||||
* @includeFunctionBody ../../test/CollectionTest.kt map
|
||||
*/
|
||||
public inline fun <T, R> java.util.Collection<T>.map(transform : (T) -> R) : java.util.List<R> {
|
||||
public inline fun <T, R> Collection<T>.map(transform : (T) -> R) : List<R> {
|
||||
return mapTo(java.util.ArrayList<R>(), transform)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user