From 0856a4dcce5ce8bf19a69f65cbcdeed9f6767971 Mon Sep 17 00:00:00 2001 From: JFronny Date: Sun, 9 Jun 2024 10:03:14 +0200 Subject: [PATCH] style: use compareValuesBy in SDProblem Comparable implementation --- src/main/kotlin/io/gitlab/jfronny/sdom/model/SDProblem.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/kotlin/io/gitlab/jfronny/sdom/model/SDProblem.kt b/src/main/kotlin/io/gitlab/jfronny/sdom/model/SDProblem.kt index b2d2d69..0c72c7b 100644 --- a/src/main/kotlin/io/gitlab/jfronny/sdom/model/SDProblem.kt +++ b/src/main/kotlin/io/gitlab/jfronny/sdom/model/SDProblem.kt @@ -10,8 +10,6 @@ data class SDProblem(val id: String, val name: String, val rgb: Color, var solve } override fun compareTo(other: SDProblem): Int { - return solved.compareTo(other.solved) - .run { if (this == 0) rgb.rgb.compareTo(other.rgb.rgb) else this } - .run { if (this == 0) name.compareTo(other.name) else this } + return compareValuesBy(this, other, SDProblem::solved, { it.rgb.rgb }, SDProblem::name) } }