Locator

Represents the placement of a single element in array data structure.

Unlike Position, the Locator class instance is stored directly in the data structure (which is array in this case) and used to propagate changes of the element's placement in result of operations. Without it you would lost the index of particular element in the array as soon as it been tossed somehow and had to look up for it again in O(n) instead of constant time access with locator.

element

element: T

Element represented by this locator. This field is read only.

Generic types (only for TS):

T - Type of elements stored in the data structure this locator belongs to.

index

index: number

Index of the element in its containing array. This field is read only.

Last updated

Was this helpful?