Replace deprecated usages of max/min with maxOrNull/minOrNull

This commit is contained in:
Alexander Udalov
2020-08-13 18:14:02 +02:00
parent 81dda96ece
commit a9ddf02556
48 changed files with 86 additions and 84 deletions
@@ -57,7 +57,7 @@ abstract class AbstractSmartStepIntoTest : KotlinLightCodeInsightFixtureTestCase
private fun renderTableWithResults(expected: List<String>, actual: List<String>): String {
val sb = StringBuilder()
val maxExtStrSize = (expected.maxBy { it.length }?.length ?: 0) + 5
val maxExtStrSize = (expected.maxOfOrNull { it.length } ?: 0) + 5
val longerList = (if (expected.size < actual.size) actual else expected).sorted()
val shorterList = (if (expected.size < actual.size) expected else actual).sorted()
for ((i, element) in longerList.withIndex()) {
@@ -145,7 +145,7 @@ private fun readClassFileImpl(
}
private fun findClassFileByPaths(packageName: String, className: String, paths: List<String>): File? =
paths.mapNotNull { path -> findClassFileByPath(packageName, className, path) }.maxBy { it.lastModified() }
paths.mapNotNull { path -> findClassFileByPath(packageName, className, path) }.maxByOrNull { it.lastModified() }
private fun findClassFileByPath(packageName: String, className: String, outputDirPath: String): File? {
val outDirFile = File(outputDirPath).takeIf(File::exists) ?: return null