Supported "lastOrNull" and "any" without break in the loop
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
fun foo(list: List<String>) {
|
||||
var found = false
|
||||
<caret>for (s in list) {
|
||||
if (s.length > 0) {
|
||||
found = true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun foo(list: List<String>) {
|
||||
<caret>val found = list.any { it.length > 0 }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
fun foo(list: List<String>) {
|
||||
var result: String? = null
|
||||
<caret>for (s in list) {
|
||||
if (s.length > 0) {
|
||||
result = s
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun foo(list: List<String>) {
|
||||
<caret>val result: String? = list.lastOrNull { it.length > 0 }
|
||||
}
|
||||
Reference in New Issue
Block a user