Introduce minOrNull and maxOrNull extension functions #KT-39064

This commit is contained in:
Abduqodiri Qurbonzoda
2020-05-20 04:56:52 +03:00
parent a8cd8ad8f8
commit 846a7823ad
14 changed files with 928 additions and 612 deletions
+1 -1
View File
@@ -71,7 +71,7 @@ public fun String.replaceIndent(newIndent: String = ""): String {
val minCommonIndent = lines
.filter(String::isNotBlank)
.map(String::indentWidth)
.min() ?: 0
.minOrNull() ?: 0
return lines.reindent(length + newIndent.length * lines.size, getIndentFunction(newIndent), { line -> line.drop(minCommonIndent) })
}