filterNotNullTo supported

This commit is contained in:
Valentin Kipyatkov
2016-04-21 21:04:47 +03:00
parent 318f3dfdd8
commit 395e61ca57
5 changed files with 66 additions and 0 deletions
@@ -0,0 +1,9 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'filterNotNullTo()'"
fun foo(list: List<String?>, target: MutableCollection<String>) {
<caret>for (s in list) {
if (s != null) {
target.add(s)
}
}
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'filterNotNullTo()'"
fun foo(list: List<String?>, target: MutableCollection<String>) {
<caret>list.filterNotNullTo(target)
}
@@ -0,0 +1,12 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'filterNotNullTo()'"
import java.util.ArrayList
fun foo(list: List<String?>) {
val target = ArrayList<String>(1000)
<caret>for (s in list) {
if (s != null) {
target.add(s)
}
}
}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'filterNotNullTo()'"
import java.util.ArrayList
fun foo(list: List<String?>) {
val <caret>target = list.filterNotNullTo(ArrayList<String>(1000))
}