tests: apply official code style
#KT-38632 Fixed
This commit is contained in:
Vendored
+7
-4
@@ -1,9 +1,12 @@
|
||||
// WITH_RUNTIME
|
||||
fun main(args: Array<String>) {
|
||||
val doSomething = doSomething("one" + 1,
|
||||
"two",
|
||||
3 * 4)
|
||||
val t = if (doSomething != null) doSomething else throw NullPointerException("Expression 'doSomething(\"one\" + 1, ...' must not be null")
|
||||
val doSomething = doSomething(
|
||||
"one" + 1,
|
||||
"two",
|
||||
3 * 4
|
||||
)
|
||||
val t = if (doSomething != null
|
||||
) doSomething else throw NullPointerException("Expression 'doSomething(\"one\" + 1, ...' must not be null")
|
||||
}
|
||||
|
||||
fun doSomething(vararg a: Any): Any? = null
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ fun foo(arg: Int): Int {
|
||||
// 1
|
||||
when (arg) {
|
||||
0 -> return 0
|
||||
// 2
|
||||
// 2
|
||||
else -> return -1
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -4,17 +4,17 @@ fun foo(arg: Any?): Int {
|
||||
is Int -> {
|
||||
return arg // 2
|
||||
}
|
||||
// 3
|
||||
// 3
|
||||
is String -> {
|
||||
return 42 // 4
|
||||
}
|
||||
// 5
|
||||
// 5
|
||||
null -> {
|
||||
// 6
|
||||
return 0
|
||||
}
|
||||
// 7
|
||||
// 8
|
||||
// 7
|
||||
// 8
|
||||
else -> return -1
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fun foo(b: Boolean) {
|
||||
if (// comment 1
|
||||
b) 1 // comment 2
|
||||
b) 1 // comment 2
|
||||
else 2
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
fun foo(a: Int) {
|
||||
if (a
|
||||
// some comment
|
||||
== 0) bar(a)
|
||||
// some comment
|
||||
== 0
|
||||
) bar(a)
|
||||
|
||||
// another comment
|
||||
else if (a == 1) bar(a)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
fun f() {
|
||||
foo(
|
||||
1,
|
||||
"a",
|
||||
2
|
||||
1,
|
||||
"a",
|
||||
2
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -3,9 +3,9 @@
|
||||
|
||||
fun f() {
|
||||
foo(
|
||||
1,
|
||||
"a",
|
||||
2,
|
||||
1,
|
||||
"a",
|
||||
2,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
fun foo(
|
||||
p: Int,
|
||||
c: Char,
|
||||
b: <caret>Boolean
|
||||
p: Int,
|
||||
c: Char,
|
||||
b: <caret>Boolean
|
||||
) {
|
||||
}
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
// SET_TRUE: ALLOW_TRAILING_COMMA
|
||||
|
||||
fun foo(
|
||||
p: Int,
|
||||
c: Char,
|
||||
b: <caret>Boolean,
|
||||
p: Int,
|
||||
c: Char,
|
||||
b: <caret>Boolean,
|
||||
) {
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
fun foo(
|
||||
p: Int,
|
||||
c: Char,
|
||||
b: <caret>Boolean
|
||||
p: Int,
|
||||
c: Char,
|
||||
b: <caret>Boolean
|
||||
) {
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
fun foo(
|
||||
p: Int,
|
||||
c: Char,
|
||||
b: <caret>Boolean
|
||||
p: Int,
|
||||
c: Char,
|
||||
b: <caret>Boolean
|
||||
) {
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fun foo(
|
||||
p: Int,
|
||||
<caret> c: Char
|
||||
p: Int,
|
||||
<caret> c: Char
|
||||
) {
|
||||
}
|
||||
+5
-4
@@ -2,9 +2,10 @@ class WithComments/* Some parameter */
|
||||
/**
|
||||
* A constructor
|
||||
*/(
|
||||
/**
|
||||
* A very important property
|
||||
*/
|
||||
val veryImportant: Any) {
|
||||
/**
|
||||
* A very important property
|
||||
*/
|
||||
val veryImportant: Any
|
||||
) {
|
||||
|
||||
}
|
||||
Vendored
+4
-2
@@ -2,7 +2,9 @@ annotation class AnnParam
|
||||
|
||||
annotation class AnnProperty
|
||||
|
||||
abstract class WithComposedModifiers(@AnnParam vararg @AnnProperty
|
||||
open val x: String) {
|
||||
abstract class WithComposedModifiers(
|
||||
@AnnParam vararg @AnnProperty
|
||||
open val x: String
|
||||
) {
|
||||
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNotNull().sum()'"
|
||||
fun f(list: List<Int?>): Int{
|
||||
val r = list
|
||||
.filterNotNull()
|
||||
.sum()
|
||||
.filterNotNull()
|
||||
.sum()
|
||||
return r
|
||||
}
|
||||
@@ -3,8 +3,8 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNotNull().sum()'"
|
||||
fun f(list: List<Int?>): Int{
|
||||
val r = list
|
||||
.asSequence()
|
||||
.filterNotNull()
|
||||
.sum()
|
||||
.asSequence()
|
||||
.filterNotNull()
|
||||
.sum()
|
||||
return r
|
||||
}
|
||||
@@ -3,6 +3,6 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterIndexed{}.any()'"
|
||||
fun foo(list: List<String>) {
|
||||
val <caret>found = list
|
||||
.filterIndexed { index, s -> s.length > index }
|
||||
.any()
|
||||
.filterIndexed { index, s -> s.length > index }
|
||||
.any()
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterIndexed{}.any()'"
|
||||
fun foo(list: List<String>) {
|
||||
val <caret>found = list
|
||||
.asSequence()
|
||||
.filterIndexed { index, s -> s.length > index }
|
||||
.any()
|
||||
.asSequence()
|
||||
.filterIndexed { index, s -> s.length > index }
|
||||
.any()
|
||||
}
|
||||
@@ -4,9 +4,9 @@
|
||||
fun getMaxLineWidth(lineCount: Int): Float {
|
||||
var max_width = 0.0f
|
||||
<caret>(0..lineCount - 1)
|
||||
.asSequence()
|
||||
.filter { getLineWidth(it) > max_width }
|
||||
.forEach { max_width = getLineWidth(it) }
|
||||
.asSequence()
|
||||
.filter { getLineWidth(it) > max_width }
|
||||
.forEach { max_width = getLineWidth(it) }
|
||||
return max_width
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
fun foo(list: List<String>): Long {
|
||||
var count = 0L
|
||||
list
|
||||
.filter { it.length > 10 }
|
||||
.forEach { count++ }
|
||||
.filter { it.length > 10 }
|
||||
.forEach { count++ }
|
||||
return count
|
||||
}
|
||||
@@ -4,8 +4,8 @@
|
||||
fun foo(list: List<String>): Long {
|
||||
var count = 0L
|
||||
list
|
||||
.asSequence()
|
||||
.filter { it.length > 10 }
|
||||
.forEach { count++ }
|
||||
.asSequence()
|
||||
.filter { it.length > 10 }
|
||||
.forEach { count++ }
|
||||
return count
|
||||
}
|
||||
+3
-3
@@ -4,8 +4,8 @@
|
||||
fun foo(list: List<String>): Int {
|
||||
var count = 0
|
||||
list
|
||||
.asSequence()
|
||||
.filter { it.length > count }
|
||||
.forEach { count++ }
|
||||
.asSequence()
|
||||
.filter { it.length > count }
|
||||
.forEach { count++ }
|
||||
return count
|
||||
}
|
||||
+2
-2
@@ -5,7 +5,7 @@ import java.util.ArrayList
|
||||
|
||||
fun foo(list: List<String>): MutableList<String> {
|
||||
val <caret>result = list
|
||||
.filter { it.length > 0 }
|
||||
.toMutableList()
|
||||
.filter { it.length > 0 }
|
||||
.toMutableList()
|
||||
return result
|
||||
}
|
||||
+3
-3
@@ -5,8 +5,8 @@ import java.util.ArrayList
|
||||
|
||||
fun foo(list: List<String>): MutableList<String> {
|
||||
val <caret>result = list
|
||||
.asSequence()
|
||||
.filter { it.length > 0 }
|
||||
.toMutableList()
|
||||
.asSequence()
|
||||
.filter { it.length > 0 }
|
||||
.toMutableList()
|
||||
return result
|
||||
}
|
||||
+2
-2
@@ -3,6 +3,6 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.forEach{}'"
|
||||
fun foo(list: List<String?>){
|
||||
list
|
||||
.filter { it != null && it.startsWith("IMG:") }
|
||||
.forEach { println(it) }
|
||||
.filter { it != null && it.startsWith("IMG:") }
|
||||
.forEach { println(it) }
|
||||
}
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.forEach{}'"
|
||||
fun foo(list: List<String?>){
|
||||
list
|
||||
.asSequence()
|
||||
.filter { it != null && it.startsWith("IMG:") }
|
||||
.forEach { println(it) }
|
||||
.asSequence()
|
||||
.filter { it != null && it.startsWith("IMG:") }
|
||||
.forEach { println(it) }
|
||||
}
|
||||
@@ -3,6 +3,6 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterIndexed{}.firstOrNull()'"
|
||||
fun foo(list: List<String>): String? {
|
||||
<caret>return list
|
||||
.filterIndexed { index, s -> s.length > index }
|
||||
.firstOrNull()
|
||||
.filterIndexed { index, s -> s.length > index }
|
||||
.firstOrNull()
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterIndexed{}.firstOrNull()'"
|
||||
fun foo(list: List<String>): String? {
|
||||
<caret>return list
|
||||
.asSequence()
|
||||
.filterIndexed { index, s -> s.length > index }
|
||||
.firstOrNull()
|
||||
.asSequence()
|
||||
.filterIndexed { index, s -> s.length > index }
|
||||
.firstOrNull()
|
||||
}
|
||||
@@ -3,6 +3,6 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterIndexed{}.firstOrNull()'"
|
||||
fun foo(list: List<String>): String? {
|
||||
<caret>return list
|
||||
.filterIndexed { i, s -> s.length > i }
|
||||
.firstOrNull()
|
||||
.filterIndexed { i, s -> s.length > i }
|
||||
.firstOrNull()
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterIndexed{}.firstOrNull()'"
|
||||
fun foo(list: List<String>): String? {
|
||||
<caret>return list
|
||||
.asSequence()
|
||||
.filterIndexed { i, s -> s.length > i }
|
||||
.firstOrNull()
|
||||
.asSequence()
|
||||
.filterIndexed { i, s -> s.length > i }
|
||||
.firstOrNull()
|
||||
}
|
||||
Vendored
+4
-4
@@ -3,8 +3,8 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence()...flatMap{}.filter{}.mapTo(){}'"
|
||||
fun foo(list: List<String>, target: MutableCollection<String>) {
|
||||
<caret>list
|
||||
.filterIndexed { i, s -> i % 10 != 0 }
|
||||
.flatMap { it.indices }
|
||||
.filter { it != 10 }
|
||||
.mapTo(target) { it.toString() }
|
||||
.filterIndexed { i, s -> i % 10 != 0 }
|
||||
.flatMap { it.indices }
|
||||
.filter { it != 10 }
|
||||
.mapTo(target) { it.toString() }
|
||||
}
|
||||
Vendored
+5
-5
@@ -3,9 +3,9 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence()...flatMap{}.filter{}.mapTo(){}'"
|
||||
fun foo(list: List<String>, target: MutableCollection<String>) {
|
||||
<caret>list
|
||||
.asSequence()
|
||||
.filterIndexed { i, s -> i % 10 != 0 }
|
||||
.flatMap { it.indices.asSequence() }
|
||||
.filter { it != 10 }
|
||||
.mapTo(target) { it.toString() }
|
||||
.asSequence()
|
||||
.filterIndexed { i, s -> i % 10 != 0 }
|
||||
.flatMap { it.indices.asSequence() }
|
||||
.filter { it != 10 }
|
||||
.mapTo(target) { it.toString() }
|
||||
}
|
||||
+2
-2
@@ -3,6 +3,6 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterIndexed{}.firstOrNull()'"
|
||||
fun foo(list: List<String>): String? {
|
||||
<caret>return list
|
||||
.filterIndexed { index, s -> s.length <= index * 10 && s.length > index }
|
||||
.firstOrNull()
|
||||
.filterIndexed { index, s -> s.length <= index * 10 && s.length > index }
|
||||
.firstOrNull()
|
||||
}
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterIndexed{}.firstOrNull()'"
|
||||
fun foo(list: List<String>): String? {
|
||||
<caret>return list
|
||||
.asSequence()
|
||||
.filterIndexed { index, s -> s.length <= index * 10 && s.length > index }
|
||||
.firstOrNull()
|
||||
.asSequence()
|
||||
.filterIndexed { index, s -> s.length <= index * 10 && s.length > index }
|
||||
.firstOrNull()
|
||||
}
|
||||
+2
-2
@@ -3,6 +3,6 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterIndexed{}.firstOrNull()'"
|
||||
fun foo(list: List<String>): String? {
|
||||
<caret>return list
|
||||
.filterIndexed { index, s -> !s.isBlank() && s.length > index }
|
||||
.firstOrNull()
|
||||
.filterIndexed { index, s -> !s.isBlank() && s.length > index }
|
||||
.firstOrNull()
|
||||
}
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterIndexed{}.firstOrNull()'"
|
||||
fun foo(list: List<String>): String? {
|
||||
<caret>return list
|
||||
.asSequence()
|
||||
.filterIndexed { index, s -> !s.isBlank() && s.length > index }
|
||||
.firstOrNull()
|
||||
.asSequence()
|
||||
.filterIndexed { index, s -> !s.isBlank() && s.length > index }
|
||||
.firstOrNull()
|
||||
}
|
||||
+2
-2
@@ -3,6 +3,6 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterIndexed{}.firstOrNull()'"
|
||||
fun foo(list: List<String>): String? {
|
||||
<caret>return list
|
||||
.filterIndexed { index, s -> s.length <= index && s.isNotBlank() }
|
||||
.firstOrNull()
|
||||
.filterIndexed { index, s -> s.length <= index && s.isNotBlank() }
|
||||
.firstOrNull()
|
||||
}
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterIndexed{}.firstOrNull()'"
|
||||
fun foo(list: List<String>): String? {
|
||||
<caret>return list
|
||||
.asSequence()
|
||||
.filterIndexed { index, s -> s.length <= index && s.isNotBlank() }
|
||||
.firstOrNull()
|
||||
.asSequence()
|
||||
.filterIndexed { index, s -> s.length <= index && s.isNotBlank() }
|
||||
.firstOrNull()
|
||||
}
|
||||
+2
-2
@@ -4,6 +4,6 @@
|
||||
fun foo(list: List<String>): String? {
|
||||
var index2 = 0
|
||||
return list
|
||||
.filterIndexed { index1, s -> s.length <= index1 && s.length >= index2++ }
|
||||
.firstOrNull()
|
||||
.filterIndexed { index1, s -> s.length <= index1 && s.length >= index2++ }
|
||||
.firstOrNull()
|
||||
}
|
||||
+3
-3
@@ -4,7 +4,7 @@
|
||||
fun foo(list: List<String>): String? {
|
||||
var index2 = 0
|
||||
return list
|
||||
.asSequence()
|
||||
.filterIndexed { index1, s -> s.length <= index1 && s.length >= index2++ }
|
||||
.firstOrNull()
|
||||
.asSequence()
|
||||
.filterIndexed { index1, s -> s.length <= index1 && s.length >= index2++ }
|
||||
.firstOrNull()
|
||||
}
|
||||
+2
-2
@@ -3,6 +3,6 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterIndexed{}.filterIndexedTo(){}'"
|
||||
fun foo(list: List<String>, target: MutableCollection<String>) {
|
||||
<caret>list
|
||||
.filterIndexed { i, s -> s.length <= i }
|
||||
.filterIndexedTo(target) { j, s -> s.length % j == 0 }
|
||||
.filterIndexed { i, s -> s.length <= i }
|
||||
.filterIndexedTo(target) { j, s -> s.length % j == 0 }
|
||||
}
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterIndexed{}.filterIndexedTo(){}'"
|
||||
fun foo(list: List<String>, target: MutableCollection<String>) {
|
||||
<caret>list
|
||||
.asSequence()
|
||||
.filterIndexed { i, s -> s.length <= i }
|
||||
.filterIndexedTo(target) { j, s -> s.length % j == 0 }
|
||||
.asSequence()
|
||||
.filterIndexed { i, s -> s.length <= i }
|
||||
.filterIndexedTo(target) { j, s -> s.length % j == 0 }
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterIsInstance<>().map{}.firstOrNull()'"
|
||||
fun foo(list: List<Any>): Int? {
|
||||
return list
|
||||
.filterIsInstance<String>()
|
||||
.map { it.length }
|
||||
.firstOrNull()
|
||||
.filterIsInstance<String>()
|
||||
.map { it.length }
|
||||
.firstOrNull()
|
||||
}
|
||||
@@ -3,8 +3,8 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterIsInstance<>().map{}.firstOrNull()'"
|
||||
fun foo(list: List<Any>): Int? {
|
||||
return list
|
||||
.asSequence()
|
||||
.filterIsInstance<String>()
|
||||
.map { it.length }
|
||||
.firstOrNull()
|
||||
.asSequence()
|
||||
.filterIsInstance<String>()
|
||||
.map { it.length }
|
||||
.firstOrNull()
|
||||
}
|
||||
+2
-2
@@ -6,6 +6,6 @@
|
||||
|
||||
fun foo(list: List<Any>, target: MutableCollection<String>) {
|
||||
<caret>target += list
|
||||
.asSequence()
|
||||
.filterIsInstance<String>()
|
||||
.asSequence()
|
||||
.filterIsInstance<String>()
|
||||
}
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterIsInstance<>().map{}.firstOrNull()'"
|
||||
fun foo(list: List<Any>): Int? {
|
||||
return list
|
||||
.filterIsInstance<String>()
|
||||
.map { it.length }
|
||||
.firstOrNull()
|
||||
.filterIsInstance<String>()
|
||||
.map { it.length }
|
||||
.firstOrNull()
|
||||
}
|
||||
+4
-4
@@ -3,8 +3,8 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterIsInstance<>().map{}.firstOrNull()'"
|
||||
fun foo(list: List<Any>): Int? {
|
||||
return list
|
||||
.asSequence()
|
||||
.filterIsInstance<String>()
|
||||
.map { it.length }
|
||||
.firstOrNull()
|
||||
.asSequence()
|
||||
.filterIsInstance<String>()
|
||||
.map { it.length }
|
||||
.firstOrNull()
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNotNull().map{}.firstOrNull()'"
|
||||
fun foo(list: List<String?>): Int? {
|
||||
<caret>return list
|
||||
.filterNotNull()
|
||||
.map { it.length }
|
||||
.firstOrNull()
|
||||
.filterNotNull()
|
||||
.map { it.length }
|
||||
.firstOrNull()
|
||||
}
|
||||
@@ -3,8 +3,8 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNotNull().map{}.firstOrNull()'"
|
||||
fun foo(list: List<String?>): Int? {
|
||||
<caret>return list
|
||||
.asSequence()
|
||||
.filterNotNull()
|
||||
.map { it.length }
|
||||
.firstOrNull()
|
||||
.asSequence()
|
||||
.filterNotNull()
|
||||
.map { it.length }
|
||||
.firstOrNull()
|
||||
}
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNotNull().map{}.firstOrNull()'"
|
||||
fun foo(list: List<Any?>): Int? {
|
||||
<caret>return list
|
||||
.filterNotNull()
|
||||
.map { it.hashCode() }
|
||||
.firstOrNull()
|
||||
.filterNotNull()
|
||||
.map { it.hashCode() }
|
||||
.firstOrNull()
|
||||
}
|
||||
+4
-4
@@ -3,8 +3,8 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNotNull().map{}.firstOrNull()'"
|
||||
fun foo(list: List<Any?>): Int? {
|
||||
<caret>return list
|
||||
.asSequence()
|
||||
.filterNotNull()
|
||||
.map { it.hashCode() }
|
||||
.firstOrNull()
|
||||
.asSequence()
|
||||
.filterNotNull()
|
||||
.map { it.hashCode() }
|
||||
.firstOrNull()
|
||||
}
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNot{}.map{}.firstOrNull()'"
|
||||
fun foo(list: List<String>): Int? {
|
||||
<caret>return list
|
||||
.filterNot { it.isEmpty() }
|
||||
.map { it.length }
|
||||
.firstOrNull()
|
||||
.filterNot { it.isEmpty() }
|
||||
.map { it.length }
|
||||
.firstOrNull()
|
||||
}
|
||||
+4
-4
@@ -3,8 +3,8 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNot{}.map{}.firstOrNull()'"
|
||||
fun foo(list: List<String>): Int? {
|
||||
<caret>return list
|
||||
.asSequence()
|
||||
.filterNot { it.isEmpty() }
|
||||
.map { it.length }
|
||||
.firstOrNull()
|
||||
.asSequence()
|
||||
.filterNot { it.isEmpty() }
|
||||
.map { it.length }
|
||||
.firstOrNull()
|
||||
}
|
||||
+2
-2
@@ -3,6 +3,6 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.forEach{}'"
|
||||
fun foo(list: List<String?>){
|
||||
list
|
||||
.filter { it != null && it.startsWith("IMG:") }
|
||||
.forEach { println(it) }
|
||||
.filter { it != null && it.startsWith("IMG:") }
|
||||
.forEach { println(it) }
|
||||
}
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.forEach{}'"
|
||||
fun foo(list: List<String?>){
|
||||
list
|
||||
.asSequence()
|
||||
.filter { it != null && it.startsWith("IMG:") }
|
||||
.forEach { println(it) }
|
||||
.asSequence()
|
||||
.filter { it != null && it.startsWith("IMG:") }
|
||||
.forEach { println(it) }
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.map{}.firstOrNull()'"
|
||||
fun foo(list: List<String>): String? {
|
||||
return list
|
||||
.filter { !it.isEmpty() && it.length < 10 && it != "abc" && it != "def" }
|
||||
.map { it + "x" }
|
||||
.firstOrNull()
|
||||
.filter { !it.isEmpty() && it.length < 10 && it != "abc" && it != "def" }
|
||||
.map { it + "x" }
|
||||
.firstOrNull()
|
||||
}
|
||||
@@ -3,8 +3,8 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.map{}.firstOrNull()'"
|
||||
fun foo(list: List<String>): String? {
|
||||
return list
|
||||
.asSequence()
|
||||
.filter { !it.isEmpty() && it.length < 10 && it != "abc" && it != "def" }
|
||||
.map { it + "x" }
|
||||
.firstOrNull()
|
||||
.asSequence()
|
||||
.filter { !it.isEmpty() && it.length < 10 && it != "abc" && it != "def" }
|
||||
.map { it + "x" }
|
||||
.firstOrNull()
|
||||
}
|
||||
+2
-2
@@ -3,6 +3,6 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterIsInstance<>().filterTo(){}'"
|
||||
fun foo(list: List<Any>, out: MutableList<String>){
|
||||
list
|
||||
.filterIsInstance<String>()
|
||||
.filterTo(out) { it.length > 0 }
|
||||
.filterIsInstance<String>()
|
||||
.filterTo(out) { it.length > 0 }
|
||||
}
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterIsInstance<>().filterTo(){}'"
|
||||
fun foo(list: List<Any>, out: MutableList<String>){
|
||||
list
|
||||
.asSequence()
|
||||
.filterIsInstance<String>()
|
||||
.filterTo(out) { it.length > 0 }
|
||||
.asSequence()
|
||||
.filterIsInstance<String>()
|
||||
.filterTo(out) { it.length > 0 }
|
||||
}
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNotNull().filter{}.forEach{}'"
|
||||
fun foo(list: List<String?>){
|
||||
list
|
||||
.filterNotNull()
|
||||
.filter { it.startsWith("IMG:") }
|
||||
.forEach { println(it.hashCode()) }
|
||||
.filterNotNull()
|
||||
.filter { it.startsWith("IMG:") }
|
||||
.forEach { println(it.hashCode()) }
|
||||
}
|
||||
+4
-4
@@ -3,8 +3,8 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNotNull().filter{}.forEach{}'"
|
||||
fun foo(list: List<String?>){
|
||||
list
|
||||
.asSequence()
|
||||
.filterNotNull()
|
||||
.filter { it.startsWith("IMG:") }
|
||||
.forEach { println(it.hashCode()) }
|
||||
.asSequence()
|
||||
.filterNotNull()
|
||||
.filter { it.startsWith("IMG:") }
|
||||
.forEach { println(it.hashCode()) }
|
||||
}
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNotNull().filter{}.forEach{}'"
|
||||
fun foo(list: List<String?>){
|
||||
list
|
||||
.filterNotNull()
|
||||
.filter { it.startsWith("IMG:") }
|
||||
.forEach { println(it.hashCode()) }
|
||||
.filterNotNull()
|
||||
.filter { it.startsWith("IMG:") }
|
||||
.forEach { println(it.hashCode()) }
|
||||
}
|
||||
+4
-4
@@ -3,8 +3,8 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNotNull().filter{}.forEach{}'"
|
||||
fun foo(list: List<String?>){
|
||||
list
|
||||
.asSequence()
|
||||
.filterNotNull()
|
||||
.filter { it.startsWith("IMG:") }
|
||||
.forEach { println(it.hashCode()) }
|
||||
.asSequence()
|
||||
.filterNotNull()
|
||||
.filter { it.startsWith("IMG:") }
|
||||
.forEach { println(it.hashCode()) }
|
||||
}
|
||||
@@ -3,8 +3,8 @@
|
||||
// IS_APPLICABLE_2: false
|
||||
fun foo(list: List<String>) {
|
||||
val <caret>result: String? = list
|
||||
.firstOrNull { it.length > 0 }
|
||||
?.let { bar(it) }
|
||||
.firstOrNull { it.length > 0 }
|
||||
?.let { bar(it) }
|
||||
}
|
||||
|
||||
fun bar(s: String): String = s
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
// IS_APPLICABLE_2: false
|
||||
fun foo(list: List<String>) {
|
||||
val <caret>result: String? = list
|
||||
.firstOrNull { it.length > 0 }
|
||||
?.let { it.substring(0, it.length - 1) }
|
||||
.firstOrNull { it.length > 0 }
|
||||
?.let { it.substring(0, it.length - 1) }
|
||||
}
|
||||
|
||||
fun bar(s: String): String = s
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
// IS_APPLICABLE_2: false
|
||||
fun foo(list: List<String>) {
|
||||
val <caret>result = list
|
||||
.firstOrNull { it.length > 0 }
|
||||
?.let { bar(it) }
|
||||
?: ""
|
||||
.firstOrNull { it.length > 0 }
|
||||
?.let { bar(it) }
|
||||
?: ""
|
||||
}
|
||||
|
||||
fun bar(s: String): String = s
|
||||
|
||||
+2
-2
@@ -3,6 +3,6 @@
|
||||
// IS_APPLICABLE_2: false
|
||||
fun foo(list: List<String>): Int? {
|
||||
<caret>return list
|
||||
.firstOrNull { it.isNotEmpty() }
|
||||
?.length
|
||||
.firstOrNull { it.isNotEmpty() }
|
||||
?.length
|
||||
}
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
// IS_APPLICABLE_2: false
|
||||
fun foo(list: List<String>): Int {
|
||||
<caret>return list
|
||||
.firstOrNull { it.isNotEmpty() }
|
||||
?.length
|
||||
?: -1
|
||||
.firstOrNull { it.isNotEmpty() }
|
||||
?.length
|
||||
?: -1
|
||||
}
|
||||
+1
-1
@@ -3,5 +3,5 @@
|
||||
// IS_APPLICABLE_2: false
|
||||
fun foo(list: List<String>): String {
|
||||
<caret>return list.firstOrNull { it.isNotEmpty() }
|
||||
?: ""
|
||||
?: ""
|
||||
}
|
||||
+2
-2
@@ -3,6 +3,6 @@
|
||||
// IS_APPLICABLE_2: false
|
||||
fun foo(list: List<String?>) {
|
||||
val <caret>result: String? = list
|
||||
.firstOrNull { it != "" }
|
||||
?.substring(1)
|
||||
.firstOrNull { it != "" }
|
||||
?.substring(1)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMap{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>): String? {
|
||||
val <caret>result: String? = list
|
||||
.flatMap { it.lines() }
|
||||
.firstOrNull { it.isNotBlank() }
|
||||
.flatMap { it.lines() }
|
||||
.firstOrNull { it.isNotBlank() }
|
||||
return result
|
||||
}
|
||||
@@ -3,8 +3,8 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMap{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>): String? {
|
||||
val <caret>result: String? = list
|
||||
.asSequence()
|
||||
.flatMap { it.lines().asSequence() }
|
||||
.firstOrNull { it.isNotBlank() }
|
||||
.asSequence()
|
||||
.flatMap { it.lines().asSequence() }
|
||||
.firstOrNull { it.isNotBlank() }
|
||||
return result
|
||||
}
|
||||
@@ -3,6 +3,6 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMap{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>): String? {
|
||||
<caret>return list
|
||||
.flatMap { it.lines() }
|
||||
.firstOrNull { !it.isBlank() }
|
||||
.flatMap { it.lines() }
|
||||
.firstOrNull { !it.isBlank() }
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMap{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>): String? {
|
||||
<caret>return list
|
||||
.asSequence()
|
||||
.flatMap { it.lines().asSequence() }
|
||||
.firstOrNull { !it.isBlank() }
|
||||
.asSequence()
|
||||
.flatMap { it.lines().asSequence() }
|
||||
.firstOrNull { !it.isBlank() }
|
||||
}
|
||||
@@ -3,6 +3,6 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMapTo(){}'"
|
||||
fun foo(list: List<String>, target: MutableList<String>) {
|
||||
<caret>list
|
||||
.asSequence()
|
||||
.flatMapTo(target) { it.lines().asSequence() }
|
||||
.asSequence()
|
||||
.flatMapTo(target) { it.lines().asSequence() }
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import java.util.ArrayList
|
||||
|
||||
fun foo(list: List<String>): List<String> {
|
||||
val <caret>target = list
|
||||
.asSequence()
|
||||
.flatMapTo(ArrayList<String>(100)) { it.lines().asSequence() }
|
||||
.asSequence()
|
||||
.flatMapTo(ArrayList<String>(100)) { it.lines().asSequence() }
|
||||
return target
|
||||
}
|
||||
@@ -4,8 +4,8 @@
|
||||
fun foo(list: List<String>): List<String> {
|
||||
val target = createCollection()
|
||||
<caret>list
|
||||
.asSequence()
|
||||
.flatMapTo(target) { it.lines().asSequence() }
|
||||
.asSequence()
|
||||
.flatMapTo(target) { it.lines().asSequence() }
|
||||
return target
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexed{}.flatMap{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>): String? {
|
||||
<caret>return list
|
||||
.mapIndexed { index, s -> s.lines().take(index) }
|
||||
.flatMap { it }
|
||||
.firstOrNull { it.isNotBlank() }
|
||||
.mapIndexed { index, s -> s.lines().take(index) }
|
||||
.flatMap { it }
|
||||
.firstOrNull { it.isNotBlank() }
|
||||
}
|
||||
@@ -3,8 +3,8 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexed{}.flatMap{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>): String? {
|
||||
<caret>return list
|
||||
.asSequence()
|
||||
.mapIndexed { index, s -> s.lines().take(index) }
|
||||
.flatMap { it.asSequence() }
|
||||
.firstOrNull { it.isNotBlank() }
|
||||
.asSequence()
|
||||
.mapIndexed { index, s -> s.lines().take(index) }
|
||||
.flatMap { it.asSequence() }
|
||||
.firstOrNull { it.isNotBlank() }
|
||||
}
|
||||
@@ -3,6 +3,6 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMap{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>): String? {
|
||||
<caret>return list
|
||||
.flatMap { it.lines() }
|
||||
.firstOrNull { it.isNotBlank() }
|
||||
.flatMap { it.lines() }
|
||||
.firstOrNull { it.isNotBlank() }
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMap{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>): String? {
|
||||
<caret>return list
|
||||
.asSequence()
|
||||
.flatMap { it.lines().asSequence() }
|
||||
.firstOrNull { it.isNotBlank() }
|
||||
.asSequence()
|
||||
.flatMap { it.lines().asSequence() }
|
||||
.firstOrNull { it.isNotBlank() }
|
||||
}
|
||||
@@ -3,6 +3,6 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.forEach{}'"
|
||||
fun foo(list: List<Int>){
|
||||
list
|
||||
.filter { it > 0 }
|
||||
.forEach { println("positive number") }
|
||||
.filter { it > 0 }
|
||||
.forEach { println("positive number") }
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.forEach{}'"
|
||||
fun foo(list: List<Int>){
|
||||
list
|
||||
.asSequence()
|
||||
.filter { it > 0 }
|
||||
.forEach { println("positive number") }
|
||||
.asSequence()
|
||||
.filter { it > 0 }
|
||||
.forEach { println("positive number") }
|
||||
}
|
||||
@@ -3,6 +3,6 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.forEachIndexed{}'"
|
||||
fun foo(list: List<String>) {
|
||||
list
|
||||
.map { it.substring(1) }
|
||||
.forEachIndexed { index, s1 -> println(s1.hashCode() * index) }
|
||||
.map { it.substring(1) }
|
||||
.forEachIndexed { index, s1 -> println(s1.hashCode() * index) }
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.forEachIndexed{}'"
|
||||
fun foo(list: List<String>) {
|
||||
list
|
||||
.asSequence()
|
||||
.map { it.substring(1) }
|
||||
.forEachIndexed { index, s1 -> println(s1.hashCode() * index) }
|
||||
.asSequence()
|
||||
.map { it.substring(1) }
|
||||
.forEachIndexed { index, s1 -> println(s1.hashCode() * index) }
|
||||
}
|
||||
@@ -3,6 +3,6 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexed{}.forEach{}'"
|
||||
fun foo(list: List<String>) {
|
||||
list
|
||||
.mapIndexed { index, s -> s.length * index }
|
||||
.forEach { println(it) }
|
||||
.mapIndexed { index, s -> s.length * index }
|
||||
.forEach { println(it) }
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexed{}.forEach{}'"
|
||||
fun foo(list: List<String>) {
|
||||
list
|
||||
.asSequence()
|
||||
.mapIndexed { index, s -> s.length * index }
|
||||
.forEach { println(it) }
|
||||
.asSequence()
|
||||
.mapIndexed { index, s -> s.length * index }
|
||||
.forEach { println(it) }
|
||||
}
|
||||
@@ -3,6 +3,6 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.forEach{}'"
|
||||
fun foo(list: List<String>) {
|
||||
list
|
||||
.filter { it.isNotBlank() }
|
||||
.forEach { println(it) }
|
||||
.filter { it.isNotBlank() }
|
||||
.forEach { println(it) }
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.forEach{}'"
|
||||
fun foo(list: List<String>) {
|
||||
list
|
||||
.asSequence()
|
||||
.filter { it.isNotBlank() }
|
||||
.forEach { println(it) }
|
||||
.asSequence()
|
||||
.filter { it.isNotBlank() }
|
||||
.forEach { println(it) }
|
||||
}
|
||||
Vendored
+3
-3
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNot{}.mapIndexed{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>): Int? {
|
||||
<caret>return list
|
||||
.filterNot { it.isBlank() }
|
||||
.mapIndexed { index, s -> s.length * index }
|
||||
.firstOrNull { it > 0 }
|
||||
.filterNot { it.isBlank() }
|
||||
.mapIndexed { index, s -> s.length * index }
|
||||
.firstOrNull { it > 0 }
|
||||
}
|
||||
Vendored
+4
-4
@@ -3,8 +3,8 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNot{}.mapIndexed{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>): Int? {
|
||||
<caret>return list
|
||||
.asSequence()
|
||||
.filterNot { it.isBlank() }
|
||||
.mapIndexed { index, s -> s.length * index }
|
||||
.firstOrNull { it > 0 }
|
||||
.asSequence()
|
||||
.filterNot { it.isBlank() }
|
||||
.mapIndexed { index, s -> s.length * index }
|
||||
.firstOrNull { it > 0 }
|
||||
}
|
||||
+3
-3
@@ -5,7 +5,7 @@
|
||||
fun foo(list: List<String>): Int? {
|
||||
var index = 0
|
||||
return list
|
||||
.filterNot { it.isBlank() }
|
||||
.map { it.length * index++ }
|
||||
.firstOrNull { it * 100 > index * index }
|
||||
.filterNot { it.isBlank() }
|
||||
.map { it.length * index++ }
|
||||
.firstOrNull { it * 100 > index * index }
|
||||
}
|
||||
+4
-4
@@ -5,8 +5,8 @@
|
||||
fun foo(list: List<String>): Int? {
|
||||
var index = 0
|
||||
return list
|
||||
.asSequence()
|
||||
.filterNot { it.isBlank() }
|
||||
.map { it.length * index++ }
|
||||
.firstOrNull { it * 100 > index * index }
|
||||
.asSequence()
|
||||
.filterNot { it.isBlank() }
|
||||
.map { it.length * index++ }
|
||||
.firstOrNull { it * 100 > index * index }
|
||||
}
|
||||
+4
-4
@@ -3,8 +3,8 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence()...mapIndexed{}.mapIndexed{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>): Int? {
|
||||
<caret>return list
|
||||
.filterNot { it.isBlank() }
|
||||
.mapIndexed { index, s -> s.length * index }
|
||||
.mapIndexed { index, x -> x * index }
|
||||
.firstOrNull { it > 1000 }
|
||||
.filterNot { it.isBlank() }
|
||||
.mapIndexed { index, s -> s.length * index }
|
||||
.mapIndexed { index, x -> x * index }
|
||||
.firstOrNull { it > 1000 }
|
||||
}
|
||||
+5
-5
@@ -3,9 +3,9 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence()...mapIndexed{}.mapIndexed{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>): Int? {
|
||||
<caret>return list
|
||||
.asSequence()
|
||||
.filterNot { it.isBlank() }
|
||||
.mapIndexed { index, s -> s.length * index }
|
||||
.mapIndexed { index, x -> x * index }
|
||||
.firstOrNull { it > 1000 }
|
||||
.asSequence()
|
||||
.filterNot { it.isBlank() }
|
||||
.mapIndexed { index, s -> s.length * index }
|
||||
.mapIndexed { index, x -> x * index }
|
||||
.firstOrNull { it > 1000 }
|
||||
}
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexed{}.mapIndexed{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>): Int? {
|
||||
return list
|
||||
.mapIndexed { index, s -> s.length * index }
|
||||
.mapIndexed { index, x -> x * index }
|
||||
.firstOrNull { it <= 1000 }
|
||||
.mapIndexed { index, s -> s.length * index }
|
||||
.mapIndexed { index, x -> x * index }
|
||||
.firstOrNull { it <= 1000 }
|
||||
}
|
||||
+4
-4
@@ -3,8 +3,8 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexed{}.mapIndexed{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>): Int? {
|
||||
return list
|
||||
.asSequence()
|
||||
.mapIndexed { index, s -> s.length * index }
|
||||
.mapIndexed { index, x -> x * index }
|
||||
.firstOrNull { it <= 1000 }
|
||||
.asSequence()
|
||||
.mapIndexed { index, s -> s.length * index }
|
||||
.mapIndexed { index, x -> x * index }
|
||||
.firstOrNull { it <= 1000 }
|
||||
}
|
||||
Vendored
+3
-3
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNot{}.mapIndexed{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>): Int? {
|
||||
<caret>return list
|
||||
.filterNot { it.isBlank() }
|
||||
.mapIndexed { index, s -> s.length * index }
|
||||
.firstOrNull { it > 0 }
|
||||
.filterNot { it.isBlank() }
|
||||
.mapIndexed { index, s -> s.length * index }
|
||||
.firstOrNull { it > 0 }
|
||||
}
|
||||
Vendored
+4
-4
@@ -3,8 +3,8 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNot{}.mapIndexed{}.firstOrNull{}'"
|
||||
fun foo(list: List<String>): Int? {
|
||||
<caret>return list
|
||||
.asSequence()
|
||||
.filterNot { it.isBlank() }
|
||||
.mapIndexed { index, s -> s.length * index }
|
||||
.firstOrNull { it > 0 }
|
||||
.asSequence()
|
||||
.filterNot { it.isBlank() }
|
||||
.mapIndexed { index, s -> s.length * index }
|
||||
.firstOrNull { it > 0 }
|
||||
}
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMap{}.filter{}.mapIndexedTo(){}'"
|
||||
fun foo(list: List<String>, target: MutableCollection<Int>) {
|
||||
<caret>list
|
||||
.flatMap { it.indices }
|
||||
.filter { it != 10 }
|
||||
.mapIndexedTo(target) { i, j -> i + j }
|
||||
.flatMap { it.indices }
|
||||
.filter { it != 10 }
|
||||
.mapIndexedTo(target) { i, j -> i + j }
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user