OCLOperators isEmpty
isEmpty () : Boolean
Returns true if self is empty; otherwise, returns false.
| Expression | Result |
|---|---|
| Sequence{2, 1}->isEmpty() | false |
| Sequence{nil}->isEmpty | true |
| <class>.EmptyList->isEmpty | true |
Example
Given Class Car:
Car.allinstances->subsequence(0,49)->isEmpty
The above will return true if the collection is empty.
Warning!
Never use ->isEmpty on a value type. The value will be converted to a list (with the value as its only item) and that will always evaluate as False.
See also: OCLOperators notEmpty
