klyn.collections.LinkedList.add
method

    public native 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.

Throws

- IndexException if index is outside `[0, size]`.

Example

    import klyn.collections

    data = LinkedList<Int>([10, 30])
    data.add(1, 20)
    print(data)  # l:[10, 20, 30]