🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
OCLOperators indexOf0
This page was created by Alexandra on 2017-08-13. Last edited by 62.169.16.147 on 2026-09-12.

indexOf0 ( object : T ) : Integer[edit | edit source][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[edit source]

Given a Class Car

Car.allInstances->asSequence().Name->indexOf0('Toyota')

This will return the position of 'Toyota' in the collection.