avoid unnecessary verbose type parameters now the type inferencer is better

This commit is contained in:
James Strachan
2012-08-17 09:44:52 +01:00
parent a4e80c7d5d
commit ecbd4daefb
10 changed files with 14 additions and 32 deletions
+2 -12
View File
@@ -80,33 +80,23 @@ class MapTest {
assertEquals("beverage,beer,location,Mells,name,James", list.makeString(","))
}
/*
TODO compiler bug
we should be able to remove the explicit type <String,String,String> on the map function
http://youtrack.jetbrains.net/issue/KT-1145
*/
test fun map() {
val m1 = TreeMap<String, String>()
m1["beverage"] = "beer"
m1["location"] = "Mells"
val list = m1.map<String,String,String>{ it.value + " rocks" }
val list = m1.map{ it.value + " rocks" }
println("Got new list $list")
assertEquals(arrayList("beer rocks", "Mells rocks"), list)
}
/*
TODO compiler bug
we should be able to remove the explicit type <String,String,String> on the mapValues function
http://youtrack.jetbrains.net/issue/KT-1145
*/
test fun mapValues() {
val m1 = TreeMap<String, String>()
m1["beverage"] = "beer"
m1["location"] = "Mells"
val m2 = m1.mapValues<String,String,String>{ it.value + "2" }
val m2 = m1.mapValues{ it.value + "2" }
println("Got new map $m2")
assertEquals(arrayList("beer2", "Mells2"), m2.values().toList())