insert method

dynamic insert(
  1. dynamic insertIdx,
  2. dynamic val
)

Implementation

insert(insertIdx, val) {
  upsert(insertIdx, val, (_, __) {
    throw Exception("duplicate index");
  });
}