klyn.collections.List.add
method

    public add(index as Int, item as T) as Void

Description

Inserts an element at the requested index.

Existing elements at and after the index are shifted to the right. Passing `size` appends the element.

Parameters

Parameter | Description
--- | ---
`index` | Zero-based insertion index in `[0, size]`.
`item` | The element to insert.

Example

    import klyn.collections

    data = [10, 30]
    data.add(1, 20)
    print(data)  # [10, 20, 30]