fun MutableLiveData.setValueIfNew(newValue: T) {
if (this.value != newValue) value = newValue
}
fun MutableLiveData.postValueIfNew(newValue: T) {
if (this.value != newValue) postValue(newValue)
}
// ObserverଆͰఆͨ͠ํ͕҆શͳؾ͕͢Δ͚ͲͲ͏ͳΜͩΖ͏ɽɽ
ᶊ
val T.checkAllMatched: T
get() = this
// ༻ྫ
// OK
when (sealed) {
ONE -> {…}
TWO -> {…}
}.checkAllMatch
// error
when (sealed) {
ONE -> {…}
//TWO -> {…}
}.checkAllMatch
ᶌ