Java to Kotlin converter: special conversion of some Collections methods

This commit is contained in:
Valentin Kipyatkov
2014-07-09 16:46:13 +04:00
parent 9bd742472d
commit 46d6ba3340
5 changed files with 99 additions and 0 deletions
@@ -0,0 +1,12 @@
//file
import java.util.*;
class A {
Map<String, String> foo() {
List<String> list1 = Collections.emptyList();
List<Integer> list2 = Collections.singletonList(1);
Set<String> set1 = Collections.emptySet();
Set<String> set2 = Collections.singleton("a");
return Collections.emptyMap();
}
}
@@ -0,0 +1,12 @@
import java.util.*
import kotlin.Map
class A {
fun foo(): Map<String, String> {
val list1 = listOf()
val list2 = listOf(1)
val set1 = setOf()
val set2 = setOf("a")
return mapOf()
}
}
@@ -0,0 +1,12 @@
import java.util.*
import kotlin.Map
class A {
fun foo(): Map<String, String> {
val list1 = listOf<String>()
val list2 = listOf(1)
val set1 = setOf<String>()
val set2 = setOf("a")
return mapOf()
}
}