Skip to content

Commit

Permalink
Improve one 'when'
Browse files Browse the repository at this point in the history
  • Loading branch information
hiqua committed Aug 3, 2021
1 parent 0bc2a8b commit a5ae2ea
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ enum class StackWidgetType(val value: Int) {

companion object {
fun getWidgetTypeFromValue(value: Int): StackWidgetType? {
return when {
CHECKMARK.value == value -> CHECKMARK
FREQUENCY.value == value -> FREQUENCY
SCORE.value == value -> SCORE
HISTORY.value == value -> HISTORY
STREAKS.value == value -> STREAKS
TARGET.value == value -> TARGET
else -> throw IllegalStateException()
return when (value) {
CHECKMARK.value -> CHECKMARK
FREQUENCY.value -> FREQUENCY
SCORE.value -> SCORE
HISTORY.value -> HISTORY
STREAKS.value -> STREAKS
TARGET.value -> TARGET
else -> null
}
}

Expand Down

0 comments on commit a5ae2ea

Please sign in to comment.