Flatten HashMap hierarhy, provide string-keyed map and set specializations.

This commit is contained in:
Ilya Gorbunov
2016-08-26 21:51:37 +03:00
parent 5833d32f25
commit e342593d2e
11 changed files with 426 additions and 352 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ class PrimitiveMapJsTest : MapJsTest() {
}
override fun <T : kotlin.Comparable<T>> Collection<T>.toNormalizedList(): List<T> = this.sorted()
override fun emptyMutableMap(): MutableMap<String, Int> = HashMap()
override fun emptyMutableMap(): MutableMap<String, Int> = stringMapOf()
override fun emptyMutableMapWithNullableKeyValue(): MutableMap<String?, Int?> = HashMap()
@test fun compareBehavior() {
+1 -1
View File
@@ -31,7 +31,7 @@ class ComplexSetJsTest : SetJsTest() {
}
class PrimitiveSetJsTest : SetJsTest() {
override fun createEmptyMutableSet(): MutableSet<String> = HashSet()
override fun createEmptyMutableSet(): MutableSet<String> = stringSetOf()
override fun createEmptyMutableSetWithNullableValues(): MutableSet<String?> = HashSet()
@Test
override fun constructors() {
+22
View File
@@ -0,0 +1,22 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.collections.js
import java.util.*
public fun <V> stringMapOf(vararg pairs: Pair<String, V>): HashMap<String, V> = hashMapOf<String, V>(*pairs)
public fun stringSetOf(vararg elements: String): HashSet<String> = hashSetOf(*elements)