Advance max/min(By/With) deprecation level to ERROR

This commit is contained in:
Abduqodiri Qurbonzoda
2021-03-25 22:05:28 +03:00
parent d70edeb38b
commit b0f1ddc91e
93 changed files with 476 additions and 572 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'filter{}.max()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.max()'"
// INTENTION_TEXT: "Replace with 'filter{}.maxOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.maxOrNull()'"
fun f(list: List<Int>) {
var result = -1
<caret>for (item in list)
@@ -1,9 +1,9 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'filter{}.max()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.max()'"
// INTENTION_TEXT: "Replace with 'filter{}.maxOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.maxOrNull()'"
fun f(list: List<Int>) {
val <caret>result = list
.filter { it % 2 == 0 }
.max()
.maxOrNull()
?: -1
}
@@ -1,10 +1,10 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'filter{}.max()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.max()'"
// INTENTION_TEXT: "Replace with 'filter{}.maxOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.maxOrNull()'"
fun f(list: List<Int>) {
val <caret>result = list
.asSequence()
.filter { it % 2 == 0 }
.max()
.maxOrNull()
?: -1
}
+2 -2
View File
@@ -1,6 +1,6 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.max()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.max()'"
// INTENTION_TEXT: "Replace with 'map{}.maxOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.maxOrNull()'"
fun getMaxLineWidth(lineCount: Int): Float {
var max_width = 0.0f
<caret>for (i in 0..lineCount - 1) {
@@ -1,10 +1,10 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.max()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.max()'"
// INTENTION_TEXT: "Replace with 'map{}.maxOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.maxOrNull()'"
fun getMaxLineWidth(lineCount: Int): Float {
val <caret>max_width = (0..lineCount - 1)
.map { getLineWidth(it) }
.max()
.maxOrNull()
?: 0.0f
return max_width
}
@@ -1,11 +1,11 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.max()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.max()'"
// INTENTION_TEXT: "Replace with 'map{}.maxOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.maxOrNull()'"
fun getMaxLineWidth(lineCount: Int): Float {
val <caret>max_width = (0..lineCount - 1)
.asSequence()
.map { getLineWidth(it) }
.max()
.maxOrNull()
?: 0.0f
return max_width
}
+2 -2
View File
@@ -1,6 +1,6 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.max()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.max()'"
// INTENTION_TEXT: "Replace with 'map{}.maxOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.maxOrNull()'"
fun getMaxLineWidth(lineCount: Int): Float {
var max_width = 0.0f
<caret>for (i in 0..lineCount - 1) {
@@ -1,10 +1,10 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.max()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.max()'"
// INTENTION_TEXT: "Replace with 'map{}.maxOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.maxOrNull()'"
fun getMaxLineWidth(lineCount: Int): Float {
val <caret>max_width = (0..lineCount - 1)
.map { getLineWidth(it) }
.max()
.maxOrNull()
?: 0.0f
return max_width
}
@@ -1,11 +1,11 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.max()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.max()'"
// INTENTION_TEXT: "Replace with 'map{}.maxOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.maxOrNull()'"
fun getMaxLineWidth(lineCount: Int): Float {
val <caret>max_width = (0..lineCount - 1)
.asSequence()
.map { getLineWidth(it) }
.max()
.maxOrNull()
?: 0.0f
return max_width
}
+2 -2
View File
@@ -1,6 +1,6 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.max()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.max()'"
// INTENTION_TEXT: "Replace with 'map{}.maxOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.maxOrNull()'"
fun getMaxLineWidth(lineCount: Int): Float {
var max_width = 0.0f
<caret>for (i in 0..lineCount - 1) {
@@ -1,10 +1,10 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.max()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.max()'"
// INTENTION_TEXT: "Replace with 'map{}.maxOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.maxOrNull()'"
fun getMaxLineWidth(lineCount: Int): Float {
val <caret>max_width = (0..lineCount - 1)
.map { getLineWidth(it) }
.max()
.maxOrNull()
?: 0.0f
return max_width
}
@@ -1,11 +1,11 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.max()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.max()'"
// INTENTION_TEXT: "Replace with 'map{}.maxOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.maxOrNull()'"
fun getMaxLineWidth(lineCount: Int): Float {
val <caret>max_width = (0..lineCount - 1)
.asSequence()
.map { getLineWidth(it) }
.max()
.maxOrNull()
?: 0.0f
return max_width
}
+1 -1
View File
@@ -1,5 +1,5 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'max()'"
// INTENTION_TEXT: "Replace with 'maxOrNull()'"
// IS_APPLICABLE_2: false
fun getMaxLineWidth(list: List<Float>): Float {
var max = 0.0f
@@ -1,8 +1,8 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'max()'"
// INTENTION_TEXT: "Replace with 'maxOrNull()'"
// IS_APPLICABLE_2: false
fun getMaxLineWidth(list: List<Float>): Float {
val <caret>max = list.max()
val <caret>max = list.maxOrNull()
?: 0.0f
return max
}
+2 -2
View File
@@ -1,6 +1,6 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.max()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.max()'"
// INTENTION_TEXT: "Replace with 'map{}.maxOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.maxOrNull()'"
fun getMaxLineWidth(count: Int): Double {
var max = 0.0
<caret>for (i in 0..count-1) {
@@ -1,10 +1,10 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.max()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.max()'"
// INTENTION_TEXT: "Replace with 'map{}.maxOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.maxOrNull()'"
fun getMaxLineWidth(count: Int): Double {
val max = (0..count-1)
.map { getLineWidth(it) }
.max()
.maxOrNull()
?: 0.0
return max
}
@@ -1,11 +1,11 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.max()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.max()'"
// INTENTION_TEXT: "Replace with 'map{}.maxOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.maxOrNull()'"
fun getMaxLineWidth(count: Int): Double {
val max = (0..count-1)
.asSequence()
.map { getLineWidth(it) }
.max()
.maxOrNull()
?: 0.0
return max
}
+2 -2
View File
@@ -1,6 +1,6 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'mapIndexed{}.max()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexed{}.max()'"
// INTENTION_TEXT: "Replace with 'mapIndexed{}.maxOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexed{}.maxOrNull()'"
fun getMaxLineWidth(list: List<Double>): Double {
var max = 0.0
<caret>for ((i, item) in list.withIndex()) {
@@ -1,10 +1,10 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'mapIndexed{}.max()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexed{}.max()'"
// INTENTION_TEXT: "Replace with 'mapIndexed{}.maxOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexed{}.maxOrNull()'"
fun getMaxLineWidth(list: List<Double>): Double {
val <caret>max = list
.mapIndexed { i, item -> item * i }
.max()
.maxOrNull()
?: 0.0
return max
}
@@ -1,11 +1,11 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'mapIndexed{}.max()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexed{}.max()'"
// INTENTION_TEXT: "Replace with 'mapIndexed{}.maxOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexed{}.maxOrNull()'"
fun getMaxLineWidth(list: List<Double>): Double {
val <caret>max = list
.asSequence()
.mapIndexed { i, item -> item * i }
.max()
.maxOrNull()
?: 0.0
return max
}
+2 -2
View File
@@ -1,6 +1,6 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.max()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.max()'"
// INTENTION_TEXT: "Replace with 'map{}.maxOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.maxOrNull()'"
import java.lang.Math.max
fun getMaxLineWidth(count: Int): Double {
@@ -1,12 +1,12 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.max()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.max()'"
// INTENTION_TEXT: "Replace with 'map{}.maxOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.maxOrNull()'"
import java.lang.Math.max
fun getMaxLineWidth(count: Int): Double {
val <caret>m = (0..count-1)
.map { getLineWidth(it) }
.max()
.maxOrNull()
?: 0.0
return m
}
@@ -1,13 +1,13 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.max()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.max()'"
// INTENTION_TEXT: "Replace with 'map{}.maxOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.maxOrNull()'"
import java.lang.Math.max
fun getMaxLineWidth(count: Int): Double {
val <caret>m = (0..count-1)
.asSequence()
.map { getLineWidth(it) }
.max()
.maxOrNull()
?: 0.0
return m
}
+2 -2
View File
@@ -1,6 +1,6 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.min()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.min()'"
// INTENTION_TEXT: "Replace with 'map{}.minOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.minOrNull()'"
fun getMinLineWidth(lineCount: Int): Double {
var min_width = Double.MAX_VALUE
<caret>for (i in 0..lineCount - 1) {
@@ -1,10 +1,10 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.min()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.min()'"
// INTENTION_TEXT: "Replace with 'map{}.minOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.minOrNull()'"
fun getMinLineWidth(lineCount: Int): Double {
val <caret>min_width = (0..lineCount - 1)
.map { getLineWidth(it) }
.min()
.minOrNull()
?: Double.MAX_VALUE
return min_width
}
@@ -1,11 +1,11 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.min()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.min()'"
// INTENTION_TEXT: "Replace with 'map{}.minOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.minOrNull()'"
fun getMinLineWidth(lineCount: Int): Double {
val <caret>min_width = (0..lineCount - 1)
.asSequence()
.map { getLineWidth(it) }
.min()
.minOrNull()
?: Double.MAX_VALUE
return min_width
}
+2 -2
View File
@@ -1,6 +1,6 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.min()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.min()'"
// INTENTION_TEXT: "Replace with 'map{}.minOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.minOrNull()'"
fun getMinLineWidth(lineCount: Int): Double {
var min_width = Double.MAX_VALUE
<caret>for (i in 0..lineCount - 1) {
@@ -1,10 +1,10 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.min()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.min()'"
// INTENTION_TEXT: "Replace with 'map{}.minOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.minOrNull()'"
fun getMinLineWidth(lineCount: Int): Double {
val <caret>min_width = (0..lineCount - 1)
.map { getLineWidth(it) }
.min()
.minOrNull()
?: Double.MAX_VALUE
return min_width
}
@@ -1,11 +1,11 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.min()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.min()'"
// INTENTION_TEXT: "Replace with 'map{}.minOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.minOrNull()'"
fun getMinLineWidth(lineCount: Int): Double {
val <caret>min_width = (0..lineCount - 1)
.asSequence()
.map { getLineWidth(it) }
.min()
.minOrNull()
?: Double.MAX_VALUE
return min_width
}
+2 -2
View File
@@ -1,6 +1,6 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.min()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.min()'"
// INTENTION_TEXT: "Replace with 'map{}.minOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.minOrNull()'"
fun getMinLineWidth(lineCount: Int): Double {
var min_width = Double.MAX_VALUE
<caret>for (i in 0..lineCount - 1) {
@@ -1,10 +1,10 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.min()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.min()'"
// INTENTION_TEXT: "Replace with 'map{}.minOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.minOrNull()'"
fun getMinLineWidth(lineCount: Int): Double {
val <caret>min_width = (0..lineCount - 1)
.map { getLineWidth(it) }
.min()
.minOrNull()
?: Double.MAX_VALUE
return min_width
}
@@ -1,11 +1,11 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.min()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.min()'"
// INTENTION_TEXT: "Replace with 'map{}.minOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.minOrNull()'"
fun getMinLineWidth(lineCount: Int): Double {
val <caret>min_width = (0..lineCount - 1)
.asSequence()
.map { getLineWidth(it) }
.min()
.minOrNull()
?: Double.MAX_VALUE
return min_width
}
+2 -2
View File
@@ -1,6 +1,6 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.min()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.min()'"
// INTENTION_TEXT: "Replace with 'map{}.minOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.minOrNull()'"
fun getMinLineWidth(lineCount: Int): Double {
var min_width = Double.MAX_VALUE
<caret>for (i in 0..lineCount - 1) {
@@ -1,10 +1,10 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.min()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.min()'"
// INTENTION_TEXT: "Replace with 'map{}.minOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.minOrNull()'"
fun getMinLineWidth(lineCount: Int): Double {
val <caret>min_width = (0..lineCount - 1)
.map { getLineWidth(it) }
.min()
.minOrNull()
?: Double.MAX_VALUE
return min_width
}
@@ -1,11 +1,11 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.min()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.min()'"
// INTENTION_TEXT: "Replace with 'map{}.minOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.minOrNull()'"
fun getMinLineWidth(lineCount: Int): Double {
val <caret>min_width = (0..lineCount - 1)
.asSequence()
.map { getLineWidth(it) }
.min()
.minOrNull()
?: Double.MAX_VALUE
return min_width
}
+2 -2
View File
@@ -1,6 +1,6 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.min()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.min()'"
// INTENTION_TEXT: "Replace with 'map{}.minOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.minOrNull()'"
fun getMinLineWidth(lineCount: Int): Double {
var min_width = Double.MAX_VALUE
<caret>for (i in 0..lineCount - 1) {
@@ -1,10 +1,10 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.min()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.min()'"
// INTENTION_TEXT: "Replace with 'map{}.minOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.minOrNull()'"
fun getMinLineWidth(lineCount: Int): Double {
val <caret>min_width = (0..lineCount - 1)
.map { getLineWidth(it) }
.min()
.minOrNull()
?: Double.MAX_VALUE
return min_width
}
@@ -1,11 +1,11 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'map{}.min()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.min()'"
// INTENTION_TEXT: "Replace with 'map{}.minOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().map{}.minOrNull()'"
fun getMinLineWidth(lineCount: Int): Double {
val <caret>min_width = (0..lineCount - 1)
.asSequence()
.map { getLineWidth(it) }
.min()
.minOrNull()
?: Double.MAX_VALUE
return min_width
}