style: use compareValuesBy in SDProblem Comparable implementation
This commit is contained in:
parent
0353c672fc
commit
0856a4dcce
@ -10,8 +10,6 @@ data class SDProblem(val id: String, val name: String, val rgb: Color, var solve
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun compareTo(other: SDProblem): Int {
|
override fun compareTo(other: SDProblem): Int {
|
||||||
return solved.compareTo(other.solved)
|
return compareValuesBy(this, other, SDProblem::solved, { it.rgb.rgb }, SDProblem::name)
|
||||||
.run { if (this == 0) rgb.rgb.compareTo(other.rgb.rgb) else this }
|
|
||||||
.run { if (this == 0) name.compareTo(other.name) else this }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user