public add(index as Int, item as T) as Void
Inserts an element at the requested index.
Existing elements at and after the index are shifted to the right. Passing size appends the element.
| Parameter | Description |
|---|---|
index | Zero-based insertion index in [0, size]. |
item | The element to insert. |
import klyn.collections data = [10, 30] data.add(1, 20) print(data) # [10, 20, 30]