"Use withIndex()" intention&inspection
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
fun foo(list: List<String>) {
|
||||
for (<spot>(index, s) in list.withIndex()</spot>) {
|
||||
print(s.substring(<spot>index</spot>))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
fun foo(list: List<String>) {
|
||||
<spot>var index = 0</spot>
|
||||
for (s in list) {
|
||||
print(s.substring(<spot>index++</spot>))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
This intention replaces manually incremented index variable for a for-loop with use of "withIndex()" function
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user