Insert item into position at given index.
Doesn't modify source array.
@param {Array} items
@param {*} item
@param {Number} index
@return {Array}
349186
function insertAt(items, item, index) {
  var copy = items.slice();
  copy.splice(index, 0, item);
  return copy;
}
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;
    }
57107
def insert(self, index, item):
        """"""
        super(ObservableList, self).insert(index, item)
        length = len(self)
        if index >= length:
            index = length - 1
        elif index < 0:
            index += length - 1
            if index < 0:
                index = 0
        self._notify_add_at(index)
1297509
function(_items) {
        var list = new List();
        if(_items) list.push.apply(list, _items);
        return list;
      }
1039706
def insertItem(self, index, item):
        """"""
        row = index.row()
        self.beginInsertRows(QtCore.QModelIndex(), row, row)
        self.model.insertRow(row)
        self.endInsertRows()
        self.model.overwriteParam(index.row(), item)
710488
function positionItem(item, itemX, itemY) {
			var legendItem = item.legendItem,
				legendLine = item.legendLine,
				legendSymbol = item.legendSymbol,
				checkbox = item.checkbox;
			if (legendItem) {
				legendItem.attr({
					x: itemX,
					y: itemY
				});
			}
			if (legendLine) {
				legendLine.translate(itemX, itemY - 4);
			}
			if (legendSymbol) {
				legendSymbol.attr({
					x: itemX + legendSymbol.xOff,
					y: itemY + legendSymbol.yOff
				});
			}
			if (checkbox) {
				checkbox.x = itemX;
				checkbox.y = itemY;
			}
		}
217065
function insert (getValue, item, list) {
    var index = binaryIndexBy(getValue, getValue(item), list);

    list.splice(index, 0, item);
    return item;
  }
166058
public function addAt(Item $item, $position = null)
    {
        if (0 === $position) {
            array_unshift($this->items, $item);
        } else if (null === $position) {
            $this->items[] = $item;
        } else if (count($this->items) <= $position) {
            $this->items[] = $item;
        } else {
            array_splice($this->items, $position, 0, [$item]);
        }

        $this->isUpdated = true;

        return $this;
    }
520372
def insertItem(self, childItem, position=None, parentIndex=None):
        
        if parentIndex is None:
            parentIndex=QtCore.QModelIndex()

        parentItem = self.getItem(parentIndex, altItem=self.invisibleRootItem)

        nChildren = parentItem.nChildren()
        if position is None:
            position = nChildren

        assert 0 <= position <= nChildren, \
            "position should be 0 < {} <= {}".format(position, nChildren)

        self.beginInsertRows(parentIndex, position, position)
        try:
            parentItem.insertChild(childItem, position)
        finally:
            self.endInsertRows()

        childIndex = self.index(position, 0, parentIndex)
        assert childIndex.isValid(), "Sanity check failed: childIndex not valid"
        return childIndex
1276820
function removeAt(items, index) {
  var copy = items.slice();
  copy.splice(index, 1);
  return copy;
}
79726
public function addToIndex(int $index, $item): bool {
        if (\count($this->array) === $this->size()) {
            $this->ensureCapacity($this->size() * 2 + 1);
        }
        $this->array[$index] = $item;
        $this->size++;
        return true;
    }
1220206
public static <E, T extends E> void add(List<E> list, int index, T item){
        if(index<list.size())
            list.add(index, item);
        else
            list.add(item);
    }
1248107
function pushUnique( arr, item ) {
  if ( arr.indexOf( item ) > -1 ) return false;
  arr.push( item );
  return true;
}
14070
def push(self, item, *, index=None):
        
        if index is None:
            self.__list.append(item)
        else:
            self.__list.insert(index, item)
        name = getattr(item, 'name', None)
        if name is not None:
            self.__dict[name] = item
111147
def add(self, *items):
        
        for item in items:
            self.unsorted.append(item)
            key = item[0]
            self.index[key] = item
        return self
342033
function add(item, index) {
      if (!item) return -1;

      if (!angular.isNumber(index)) {
        index = _items.length;
      }

      _items.splice(index, 0, item);

      return indexOf(item);
    }
975216
function(items) {
            items = $.makeArray(items);

            for (var i = 0; i < items.length; i++) {
                var item = items[i];

                // Make sure we actually know about this item
                var index = $.inArray(item, this.$items);
                if (index !== -1) {
                    this._deinitItem(item);
                    this.$items.splice(index, 1);
                }
            }
        }