Supported indexOf/lastIndexOf
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'indexOf()'"
|
||||
fun foo(list: List<String>): Int {
|
||||
<caret>for ((index, s) in list.withIndex()) {
|
||||
if (s == "a") {
|
||||
return index
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'indexOf()'"
|
||||
fun foo(list: List<String>): Int {
|
||||
<caret>return list.indexOf("a")
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'lastIndexOf()'"
|
||||
fun foo(list: List<String>) {
|
||||
var result = -1
|
||||
<caret>for ((index, s) in list.withIndex()) {
|
||||
if (s == "a") {
|
||||
result = index
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: "Replace with 'lastIndexOf()'"
|
||||
fun foo(list: List<String>) {
|
||||
val <caret>result = list.lastIndexOf("a")
|
||||
}
|
||||
Reference in New Issue
Block a user