OCLOperators indexOf0
Created by Alexandra on 2017-08-13 · Last edited by Peter.byaruhanga on 2025-12-18.
indexOf0 ( object : T ) : Integer[edit | edit source]
Returns the position of object in sequence self - 0 based.
| Expression | Result |
|---|---|
| Sequence{'a', 'b'}->indexOf0('a') | 0 |
The zero-based index of an object in the collection is possibly -1 if nonexistent.
See discussion and reason for introduction of IndexOf0 operator at page of IndexOf operator
See also at0
Example
Given a Class Car
Car.allInstances->asSequence().Name->indexOf0('Toyota')This will return the position of 'Toyota' in the collection.
