Inserts an element at the given index
435721
public void add(int index, Object element) {

//        reporter.updateCounter++;
        if (index > elementCount) {
            throw new IndexOutOfBoundsException("Index out of bounds: "
                                                + index + ">" + elementCount);
        }

        if (index < 0) {
            throw new IndexOutOfBoundsException("Index out of bounds: "
                                                + index + " < 0");
        }

        if (elementCount >= elementData.length) {
            increaseCapacity();
        }

        for (int i = elementCount; i > index; i--) {
            elementData[i] = elementData[i - 1];
        }

        elementData[index] = element;

        elementCount++;
    }
780704
function insertAt(parent, index, html) {
  console.log('inserting at ' + index + ' ' + html);
  console.log(parent);
  if (index === 0)
    return parent.prepend(html);
  parent.children(':nth-child(' + index + ')').after(html);
}
158512
def insert(self, index, x):
        
        self.real_list.insert(index, x)
        self.observer(UpdateType.CREATED, x, index)
88462
public StrBuilder insert(int index, Object obj) {
		if (obj instanceof CharSequence) {
			return insert(index, (CharSequence) obj);
		}
		return insert(index, Convert.toStr(obj));
	}
1130670
def []=(index, value)
      index = validate_index_range(index)

      @store.transaction do
        if index < @entry_counter
          # Overwrite of an existing element
          @root.set(index, value)
        elsif index == @entry_counter
          # Append right at the end
          @root.insert(index, value)
          self.entry_counter += 1
        else
          # Append with nil padding
          @entry_counter.upto(index - 1) do |i|
            @root.insert(i, nil)
          end
          @root.insert(index, value)
          self.entry_counter = index + 1
        end
      end
    end
437464
def insert(self, index, key, value):
        """"""
        if key in self.keyOrder:
            n = self.keyOrder.index(key)
            del self.keyOrder[n]
            if n < index:
                index -= 1
        self.keyOrder.insert(index, key)
        super(SortedDict, self).__setitem__(key, value)
570815
public void insertItem (T item, int index, String label)
    {
        insertItem(label == null ? toLabel(item) : label, index);
        _items.add(index, item);
    }
971431
public function add($element, $index = null) {
		if ($index === null) {
			$this->array[$this->count()] = $element;
		} else {
			array_splice($this->array, $index, 0, $element);
		}

		return $this;
	}
307213
public void insert(StringBuilder buffer, Object value, int index) {
        if (buffer == null) {
            throw new NullPointerException("buffer");
        }

        buffer.insert(index, value);
    }
226839
function (key, value) {
        var index = this.indexOfKey(key);

        if (index >= 0) {
            this.slot.values[index] = value;
            return;
        }

        this.insert(~index, key, value);
    }
82937
@Override
    public void add(int index, E element) {
        final ReentrantLock lock = this.lock;
        lock.lock();
        try {
            Object[] elements = getArray();
            int len = elements.length;
            if (index > len || index < 0)
                throw new IndexOutOfBoundsException("Index: " + index +
                                                    ", Size: " + len);
            Object[] newElements;
            int numMoved = len - index;
            if (numMoved == 0)
                newElements = Arrays.copyOf(elements, len + 1);
            else {
                newElements = new Object[len + 1];
                System.arraycopy(elements, 0, newElements, 0, index);
                System.arraycopy(elements, index, newElements, index + 1,
                                 numMoved);
            }
            newElements[index] = element;
            setArray(newElements);
        } finally {
            lock.unlock();
        }
    }
745459
function(index) {
      index = Math.min(index, this.length);
      arguments.length > 1
      && this.splice.apply(this, [index, 0].concat([].pop.call(arguments)))
      && this.insert.apply(this, arguments);
      return this;
    }
60531
public void addToCell(int index, int element) {
        if (cells.size() < index + 1) {
            addSingletonCell(element);
        } else {
            cells.get(index).add(element);
        }
    }
1339363
public void insertAdapterItem(TwinTextItem item, int index) {
        int selection = getSelectedItemPosition();
        Object selectedItem = getSelectedItem();
        ((PickerSpinnerAdapter) getAdapter()).insert(item, index);
        // select the new item if there was an equal temporary item selected
        if(selectedItem.equals(item))
            setSelectionQuietly(index);
        // otherwise keep track when inserting above the selection
        else if(index <= selection)
            setSelectionQuietly(selection+1);
    }
496941
public final void insertNullElementsAt(int index, int count)
  {
    if (tc.isEntryEnabled())
      SibTr.entry(
        tc,
        "insertNullElementsAt",
        new Object[] { new Integer(index), new Integer(count)});

    for (int i = index; i < index + count; i++)
      add(i, null);

    if (tc.isEntryEnabled())
      SibTr.exit(tc, "insertNullElementsAt");
  }
935775
def insert(self, index, value):
        """"""
        return super(Collection, self).insert(
            index, self._ensure_value_is_valid(value))
586214
@SuppressWarnings("unchecked")
	public static <T> T[] insert(T[] buffer, int index, T... newElements) {
		return (T[]) insert((Object)buffer, index, newElements);
	}