lib/Ext/util/Collection.js
function(index, key, item) {
        var me = this,
            sorted = this.sorted,
            map = this.map,
            filtered = this.filtered;

        if (arguments.length == 2) {
            item = key;
            key = me.getKey(item);
        }

        if (index >= me.length || (sorted && me.getAutoSort())) {
            return me.add(key, item);
        }

        if (typeof key != 'undefined' && key !== null) {
            if (typeof map[key] != 'undefined') {
                me.replace(key, item);
                return false;
            }
            map[key] = item;
        }

        this.all.push(item);

        if (filtered && this.getAutoFilter() && this.mixins.filterable.isFiltered.call(me, item)) {
            return null;
        }

        me.length++;

        Ext.Array.splice(me.items, index, 0, item);
        Ext.Array.splice(me.keys, index, 0, key);

        me.dirtyIndices = true;

        return item;
    }
function(index, key, item) {
        var me = this,
            sorted = this.sorted,
            map = this.map,
            filtered = this.filtered;

        if (arguments.length == 2) {
            item = key;
            key = me.getKey(item);
        }

        if (index >= me.length || (sorted && me.getAutoSort())) {
            return me.add(key, item);
        }

        if (typeof key != 'undefined' && key !== null) {
            if (typeof map[key] != 'undefined') {
                me.replace(key, item);
                return false;
            }
            map[key] = item;
        }

        this.all.push(item);

        if (filtered && this.getAutoFilter() && this.mixins.filterable.isFiltered.call(me, item)) {
            return null;
        }

        me.length++;

        Ext.Array.splice(me.items, index, 0, item);
        Ext.Array.splice(me.keys, index, 0, key);

        me.dirtyIndices = true;

        return item;
    }
Inserts an item at the specified index in the collection. Fires the {@link #add} event when complete.
@param {Number} index The index to insert the item at.
@param {String} key The key to associate with the new item, or the item itself.
@param {Object} item If the second parameter was a key, the new item.
@return {Object} The item inserted.