any() and other find operations to work with checks for not null and is instance

This commit is contained in:
Valentin Kipyatkov
2016-10-14 16:58:40 +03:00
parent 49ef880f3a
commit 35ed689b9f
6 changed files with 34 additions and 4 deletions
@@ -0,0 +1,9 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'any{}'"
// IS_APPLICABLE_2: false
fun foo(list: List<Any?>): Boolean {
<caret>for (a in list) {
if (a != null) return true
}
return false
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'any{}'"
// IS_APPLICABLE_2: false
fun foo(list: List<Any?>): Boolean {
<caret>return list.any { it != null }
}