August 2017
Intermediate to advanced
440 pages
10h
English
The vetoable function is a standard library property delegate that works in a similar way to the observable delegate, but with two main differences:
For example, if we have an assumption that the list must always contain a larger number of items than the old one, then we will define the following vetoable delegate:
var list: List<String> by Delegates.vetoable(emptyList()) { _, old, new ->
new.size > old.size
}
If a new list does not contain a larger number of items than the old one, then the value will not change. So, we can treat vetoable like observable ...
Read now
Unlock full access