tests: apply official code style

#KT-38632 Fixed
This commit is contained in:
Dmitry Gridin
2020-04-28 15:51:57 +07:00
parent d8f9643650
commit 11a3482970
406 changed files with 1785 additions and 1525 deletions
@@ -5,7 +5,7 @@ import java.util.ArrayList
fun foo(list: List<String>): List<Int> {
val result = list
.filter { it.length > 0 }
.map { it.hashCode() }
.filter { it.length > 0 }
.map { it.hashCode() }
return result
}
@@ -5,9 +5,9 @@ import java.util.ArrayList
fun foo(list: List<String>): List<Int> {
val result = list
.asSequence()
.filter { it.length > 0 }
.map { it.hashCode() }
.toList()
.asSequence()
.filter { it.length > 0 }
.map { it.hashCode() }
.toList()
return result
}
@@ -5,7 +5,7 @@ import java.util.ArrayList
fun foo(list: List<String>): List<Int> {
val <caret>result = list
.filter { it.length > 0 }
.map { it.hashCode() }
.filter { it.length > 0 }
.map { it.hashCode() }
return result
}
@@ -5,9 +5,9 @@ import java.util.ArrayList
fun foo(list: List<String>): List<Int> {
val <caret>result = list
.asSequence()
.filter { it.length > 0 }
.map { it.hashCode() }
.toList()
.asSequence()
.filter { it.length > 0 }
.map { it.hashCode() }
.toList()
return result
}
+2 -2
View File
@@ -3,6 +3,6 @@
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
<caret>return list
.map { it.length }
.firstOrNull { it > 0 }
.map { it.length }
.firstOrNull { it > 0 }
}
+3 -3
View File
@@ -3,7 +3,7 @@
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
<caret>return list
.asSequence()
.map { it.length }
.firstOrNull { it > 0 }
.asSequence()
.map { it.length }
.firstOrNull { it > 0 }
}
@@ -3,7 +3,7 @@
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.filterIndexed{}.firstOrNull()'"
fun foo(list: List<String>): Int? {
<caret>return list
.map { it.length }
.filterIndexed { index, l -> l > index }
.firstOrNull()
.map { it.length }
.filterIndexed { index, l -> l > index }
.firstOrNull()
}
@@ -3,8 +3,8 @@
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.filterIndexed{}.firstOrNull()'"
fun foo(list: List<String>): Int? {
<caret>return list
.asSequence()
.map { it.length }
.filterIndexed { index, l -> l > index }
.firstOrNull()
.asSequence()
.map { it.length }
.filterIndexed { index, l -> l > index }
.firstOrNull()
}
@@ -3,6 +3,6 @@
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexed{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
<caret>return list
.mapIndexed { index, s -> s.length * index }
.firstOrNull { it > 0 }
.mapIndexed { index, s -> s.length * index }
.firstOrNull { it > 0 }
}
@@ -3,7 +3,7 @@
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexed{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
<caret>return list
.asSequence()
.mapIndexed { index, s -> s.length * index }
.firstOrNull { it > 0 }
.asSequence()
.mapIndexed { index, s -> s.length * index }
.firstOrNull { it > 0 }
}
@@ -3,6 +3,6 @@
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexedNotNull{}.mapTo(){}'"
fun foo(list: List<String?>, target: MutableList<String>) {
<caret>list
.mapIndexedNotNull { index, s -> s?.substring(index)?.length }
.mapTo(target) { it.toString() }
.mapIndexedNotNull { index, s -> s?.substring(index)?.length }
.mapTo(target) { it.toString() }
}
@@ -3,7 +3,7 @@
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexedNotNull{}.mapTo(){}'"
fun foo(list: List<String?>, target: MutableList<String>) {
<caret>list
.asSequence()
.mapIndexedNotNull { index, s -> s?.substring(index)?.length }
.mapTo(target) { it.toString() }
.asSequence()
.mapIndexedNotNull { index, s -> s?.substring(index)?.length }
.mapTo(target) { it.toString() }
}
@@ -3,6 +3,6 @@
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexedNotNull{}.mapTo(){}'"
fun foo(list: List<String?>, target: MutableList<String>) {
<caret>list
.mapIndexedNotNull { index, s -> s?.substring(index)?.length }
.mapTo(target) { it.toString() }
.mapIndexedNotNull { index, s -> s?.substring(index)?.length }
.mapTo(target) { it.toString() }
}
@@ -3,7 +3,7 @@
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexedNotNull{}.mapTo(){}'"
fun foo(list: List<String?>, target: MutableList<String>) {
<caret>list
.asSequence()
.mapIndexedNotNull { index, s -> s?.substring(index)?.length }
.mapTo(target) { it.toString() }
.asSequence()
.mapIndexedNotNull { index, s -> s?.substring(index)?.length }
.mapTo(target) { it.toString() }
}
@@ -3,7 +3,7 @@
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNot{}.mapIndexed{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
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 }
}
@@ -3,8 +3,8 @@
// INTENTION_TEXT_2: "Replace with 'asSequence().filterNot{}.mapIndexed{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
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,7 +3,7 @@
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexed{}.mapIndexed{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
<caret>return list
.mapIndexed { index, s -> s.length * index }
.mapIndexed { index, x -> x + index }
.firstOrNull { it > 0 }
.mapIndexed { index, s -> s.length * index }
.mapIndexed { index, x -> x + index }
.firstOrNull { it > 0 }
}
@@ -3,8 +3,8 @@
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexed{}.mapIndexed{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
<caret>return list
.asSequence()
.mapIndexed { index, s -> s.length * index }
.mapIndexed { index, x -> x + index }
.firstOrNull { it > 0 }
.asSequence()
.mapIndexed { index, s -> s.length * index }
.mapIndexed { index, x -> x + index }
.firstOrNull { it > 0 }
}
@@ -3,6 +3,6 @@
// INTENTION_TEXT_2: "Replace with 'asSequence().mapNotNull{}.mapTo(){}'"
fun foo(list: List<String?>, target: MutableList<String>) {
<caret>list
.mapNotNull { it?.length }
.mapTo(target) { it.toString() }
.mapNotNull { it?.length }
.mapTo(target) { it.toString() }
}
@@ -3,7 +3,7 @@
// INTENTION_TEXT_2: "Replace with 'asSequence().mapNotNull{}.mapTo(){}'"
fun foo(list: List<String?>, target: MutableList<String>) {
<caret>list
.asSequence()
.mapNotNull { it?.length }
.mapTo(target) { it.toString() }
.asSequence()
.mapNotNull { it?.length }
.mapTo(target) { it.toString() }
}
@@ -3,6 +3,6 @@
// INTENTION_TEXT_2: "Replace with 'asSequence().mapNotNull{}.mapTo(){}'"
fun foo(list: List<String?>, target: MutableList<String>) {
<caret>list
.mapNotNull { it?.length }
.mapTo(target) { it.toString() }
.mapNotNull { it?.length }
.mapTo(target) { it.toString() }
}
@@ -3,7 +3,7 @@
// INTENTION_TEXT_2: "Replace with 'asSequence().mapNotNull{}.mapTo(){}'"
fun foo(list: List<String?>, target: MutableList<String>) {
<caret>list
.asSequence()
.mapNotNull { it?.length }
.mapTo(target) { it.toString() }
.asSequence()
.mapNotNull { it?.length }
.mapTo(target) { it.toString() }
}
@@ -3,9 +3,9 @@
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMap{}.mapNotNull{}.mapTo(){}'"
fun foo(list: List<String>, target: MutableList<String>) {
<caret>list
.flatMap { it.indices }
.mapNotNull { bar(it) }
.mapTo(target) { it.substring(1) }
.flatMap { it.indices }
.mapNotNull { bar(it) }
.mapTo(target) { it.substring(1) }
}
fun bar(p: Int): String? = null
@@ -3,10 +3,10 @@
// INTENTION_TEXT_2: "Replace with 'asSequence().flatMap{}.mapNotNull{}.mapTo(){}'"
fun foo(list: List<String>, target: MutableList<String>) {
<caret>list
.asSequence()
.flatMap { it.indices.asSequence() }
.mapNotNull { bar(it) }
.mapTo(target) { it.substring(1) }
.asSequence()
.flatMap { it.indices.asSequence() }
.mapNotNull { bar(it) }
.mapTo(target) { it.substring(1) }
}
fun bar(p: Int): String? = null
@@ -3,6 +3,6 @@
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.mapTo(){}'"
fun foo(list: List<String>, target: MutableList<Int>) {
<caret>list
.filter { it.length > 0 }
.mapTo(target) { it.hashCode() }
.filter { it.length > 0 }
.mapTo(target) { it.hashCode() }
}
@@ -3,7 +3,7 @@
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.mapTo(){}'"
fun foo(list: List<String>, target: MutableList<Int>) {
<caret>list
.asSequence()
.filter { it.length > 0 }
.mapTo(target) { it.hashCode() }
.asSequence()
.filter { it.length > 0 }
.mapTo(target) { it.hashCode() }
}
@@ -5,7 +5,7 @@ import java.util.ArrayList
fun foo(list: List<String>): List<Int> {
val <caret>target = list
.filter { it.length > 0 }
.mapTo(ArrayList<Int>(100)) { it.hashCode() }
.filter { it.length > 0 }
.mapTo(ArrayList<Int>(100)) { it.hashCode() }
return target
}
@@ -5,8 +5,8 @@ import java.util.ArrayList
fun foo(list: List<String>): List<Int> {
val <caret>target = list
.asSequence()
.filter { it.length > 0 }
.mapTo(ArrayList<Int>(100)) { it.hashCode() }
.asSequence()
.filter { it.length > 0 }
.mapTo(ArrayList<Int>(100)) { it.hashCode() }
return target
}
@@ -4,8 +4,8 @@
fun foo(list: List<String>): List<Int> {
val target = createCollection()
<caret>list
.filter { it.length > 0 }
.mapTo(target) { it.hashCode() }
.filter { it.length > 0 }
.mapTo(target) { it.hashCode() }
return target
}
@@ -4,9 +4,9 @@
fun foo(list: List<String>): List<Int> {
val target = createCollection()
<caret>list
.asSequence()
.filter { it.length > 0 }
.mapTo(target) { it.hashCode() }
.asSequence()
.filter { it.length > 0 }
.mapTo(target) { it.hashCode() }
return target
}
@@ -3,6 +3,6 @@
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.forEach{}'"
fun foo(list: List<String>, target: MutableList<Int>) {
list
.filter { it.length > 0 }
.forEach { target.add(0) }
.filter { it.length > 0 }
.forEach { target.add(0) }
}
@@ -3,7 +3,7 @@
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.forEach{}'"
fun foo(list: List<String>, target: MutableList<Int>) {
list
.asSequence()
.filter { it.length > 0 }
.forEach { target.add(0) }
.asSequence()
.filter { it.length > 0 }
.forEach { target.add(0) }
}
@@ -3,6 +3,6 @@
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
<caret>return list
.map { it.length }
.firstOrNull { it > 0 }
.map { it.length }
.firstOrNull { it > 0 }
}
@@ -3,7 +3,7 @@
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
<caret>return list
.asSequence()
.map { it.length }
.firstOrNull { it > 0 }
.asSequence()
.map { it.length }
.firstOrNull { it > 0 }
}