Make Boolean comparison more efficient
authorLanius Trolling <lanius@laniustrolling.dev>
Sun, 18 Jun 2023 13:44:30 +0000 (09:44 -0400)
committerLanius Trolling <lanius@laniustrolling.dev>
Sun, 18 Jun 2023 13:44:30 +0000 (09:44 -0400)
src/main/kotlin/info/mechyrdia/lore/article_listing.kt

index e337163cc2a6d80939dd4140f1a7da78b8f6f50b..81c1029208dc37ea9365518c90c075ae46c34e23 100644 (file)
@@ -12,12 +12,7 @@ fun File.toArticleNode(): ArticleNode = ArticleNode(
                .orEmpty()
                .map { it.toArticleNode() }
                .sortedBy { it.name }
-               .sortedBy { node ->
-                       if (node.subNodes.isNotEmpty())
-                               0
-                       else
-                               1
-               }
+               .sortedBy { it.subNodes.isEmpty() }
 )
 
 fun List<ArticleNode>.renderInto(list: UL, base: String? = null) {