SimplifiableCallChainInspection: replace .sorted().firstOrNull() with .min()
#KT-30725 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
bdac47369c
commit
3de723b8d0
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
// WITH_RUNTIME
|
||||
val x = listOf("a" to 1, ,"c" to 3, "b" to 2).<caret>sortedByDescending { it.second }.firstOrNull()
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
// WITH_RUNTIME
|
||||
val x = listOf("a" to 1, ,"c" to 3, "b" to 2).maxBy { it.second }
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
// WITH_RUNTIME
|
||||
val x = listOf("a" to 1, ,"c" to 3, "b" to 2).<caret>sortedByDescending { it.second }.lastOrNull()
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
// WITH_RUNTIME
|
||||
val x = listOf("a" to 1, ,"c" to 3, "b" to 2).minBy { it.second }
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
// WITH_RUNTIME
|
||||
val x = listOf("a" to 1, ,"c" to 3, "b" to 2).<caret>sortedBy { it.second }.firstOrNull()
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
// WITH_RUNTIME
|
||||
val x = listOf("a" to 1, ,"c" to 3, "b" to 2).minBy { it.second }
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
// WITH_RUNTIME
|
||||
val x = listOf("a" to 1, ,"c" to 3, "b" to 2).<caret>sortedBy { it.second }.lastOrNull()
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
// WITH_RUNTIME
|
||||
val x = listOf("a" to 1, ,"c" to 3, "b" to 2).maxBy { it.second }
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
// WITH_RUNTIME
|
||||
val x = listOf(1, 3, 2).<caret>sortedDescending().firstOrNull()
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
// WITH_RUNTIME
|
||||
val x = listOf(1, 3, 2).max()
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
// WITH_RUNTIME
|
||||
val x = listOf(1, 3, 2).<caret>sortedDescending().lastOrNull()
|
||||
idea/testData/inspectionsLocal/collections/simplifiableCallChain/sortedDescendingLastOrNull.kt.after
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
// WITH_RUNTIME
|
||||
val x = listOf(1, 3, 2).min()
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
// WITH_RUNTIME
|
||||
val x = listOf(1, 3, 2).<caret>sorted().firstOrNull()
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
// WITH_RUNTIME
|
||||
val x = listOf(1, 3, 2).min()
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
// WITH_RUNTIME
|
||||
val x = listOf(1, 3, 2).<caret>sorted().lastOrNull()
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
// WITH_RUNTIME
|
||||
val x = listOf(1, 3, 2).max()
|
||||
Reference in New Issue
Block a user