using compareTo instead of direct subtraction

This commit is contained in:
Adam Brown 2022-05-16 17:16:37 +01:00
parent a893f5acdb
commit 6c3150edb7

View file

@ -21,7 +21,7 @@ import org.matrix.android.sdk.api.auth.registration.Stage
class FtueMissingRegistrationStagesComparator : Comparator<Stage> { class FtueMissingRegistrationStagesComparator : Comparator<Stage> {
override fun compare(a: Stage?, b: Stage?): Int { override fun compare(a: Stage?, b: Stage?): Int {
return (a?.toPriority() ?: 0) - (b?.toPriority() ?: 0) return (a?.toPriority() ?: 0).compareTo(b?.toPriority() ?: 0)
} }
private fun Stage.toPriority() = when (this) { private fun Stage.toPriority() = when (this) {