Refactoring: make "loop to call chain" AbstractKotlinInspection
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
fun foo(list: List<String>): String? {
|
||||
<spot>return list.firstOrNull { it.length > 0 }</spot>
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
fun foo(list: List<String>): String? {
|
||||
<spot>for (s in list) {
|
||||
if (s.length > 0) {
|
||||
return s
|
||||
}
|
||||
}
|
||||
return null</spot>
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
This intention converts a for-loop into a sequence of stdlib-operations (like "map", "filter" etc)
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,7 +0,0 @@
|
||||
fun foo(list: List<String>) {
|
||||
val sum = <spot>list
|
||||
.asSequence()
|
||||
.map { it.calcSomething() }
|
||||
.filter { it > 0 }
|
||||
.sumBy { it }</spot>
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
fun foo(list: List<String>) {
|
||||
val sum = 0
|
||||
<spot>for (s in list) {
|
||||
val x = s.calcSomething()
|
||||
if (x > 0) {
|
||||
sum += x
|
||||
}
|
||||
}</spot>
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
This intention converts a for-loop into a sequence of stdlib-operations (like "map", "filter" etc) with lazy evaluation (using 'asSequence()' method)
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user