static/ext/src/util/AbstractMixedCollection.js
function(index, keys, objects) {
        var me = this,
            itemKey,
            removeIndex,
            i, len = keys.length,
            fireAdd = me.hasListeners.add,
            syncIndices;

        // External key(s) passed. We cannot reliably find an object's index using the key extraction fn.
        // Set a flag for use by contains, indexOf and remove
        if (objects != null) {
            me.useLinearSearch = true
        }
        // No external keys: calculate keys array if not passed
        else {
            objects = keys;
            keys = new Array(len);
            for (i = 0; i < len; i++) {
                keys[i] = this.getKey(objects[i]);
            }
        }

        // First, remove duplicates of the keys. If a removal point is less than insertion index, decr insertion index
        me.suspendEvents();
        for (i = 0; i < len; i++) {
            // Must use indexOf - map might be out of sync
            removeIndex = me.indexOfKey(keys[i]);
            if (removeIndex !== -1) {
                if (removeIndex < index) {
                    index--;
                }
                me.removeAt(removeIndex);
            }
        }
        me.resumeEvents();

        // If we are appending and the indices are in sync, its cheap to kep them that way
        syncIndices = index === me.length && me.indexGeneration === me.generation;

        // Insert the new items and new keys in at the insertion point
        Ext.Array.insert(me.items, index, objects);
        Ext.Array.insert(me.keys,  index, keys);
        me.length += len;
        me.generation++;
        if (syncIndices) {
            me.indexGeneration = me.generation;
        }
        for (i = 0; i < len; i++, index++) {
            itemKey = keys[i];
            if (itemKey != null) {
                me.map[itemKey] = objects[i];

                // If the index is still in sync, keep it that way
                if (syncIndices) {
                    me.indexMap[itemKey] = index;
                }
            }
            if (fireAdd) {
                me.fireEvent('add', index, objects[i], itemKey);
            }
        }
        return objects;
    }
function(index, keys, objects) {
        var me = this,
            itemKey,
            removeIndex,
            i, len = keys.length,
            fireAdd = me.hasListeners.add,
            syncIndices;

        // External key(s) passed. We cannot reliably find an object's index using the key extraction fn.
        // Set a flag for use by contains, indexOf and remove
        if (objects != null) {
            me.useLinearSearch = true
        }
        // No external keys: calculate keys array if not passed
        else {
            objects = keys;
            keys = new Array(len);
            for (i = 0; i < len; i++) {
                keys[i] = this.getKey(objects[i]);
            }
        }

        // First, remove duplicates of the keys. If a removal point is less than insertion index, decr insertion index
        me.suspendEvents();
        for (i = 0; i < len; i++) {
            // Must use indexOf - map might be out of sync
            removeIndex = me.indexOfKey(keys[i]);
            if (removeIndex !== -1) {
                if (removeIndex < index) {
                    index--;
                }
                me.removeAt(removeIndex);
            }
        }
        me.resumeEvents();

        // If we are appending and the indices are in sync, its cheap to kep them that way
        syncIndices = index === me.length && me.indexGeneration === me.generation;

        // Insert the new items and new keys in at the insertion point
        Ext.Array.insert(me.items, index, objects);
        Ext.Array.insert(me.keys,  index, keys);
        me.length += len;
        me.generation++;
        if (syncIndices) {
            me.indexGeneration = me.generation;
        }
        for (i = 0; i < len; i++, index++) {
            itemKey = keys[i];
            if (itemKey != null) {
                me.map[itemKey] = objects[i];

                // If the index is still in sync, keep it that way
                if (syncIndices) {
                    me.indexMap[itemKey] = index;
                }
            }
            if (fireAdd) {
                me.fireEvent('add', index, objects[i], itemKey);
            }
        }
        return objects;
    }
function ( index , keys , objects ) { var me = this , itemKey , removeIndex , i , len = keys . length , fireAdd = me . hasListeners . add , syncIndices ; // External key(s) passed. We cannot reliably find an object's index using the key extraction fn. // Set a flag for use by contains, indexOf and remove if ( objects != null ) { me . useLinearSearch = true } // No external keys: calculate keys array if not passed else { objects = keys ; keys = new Array ( len ) ; for ( i = 0 ; i < len ; i ++ ) { keys [ i ] = this . getKey ( objects [ i ] ) ; } } // First, remove duplicates of the keys. If a removal point is less than insertion index, decr insertion index me . suspendEvents ( ) ; for ( i = 0 ; i < len ; i ++ ) { // Must use indexOf - map might be out of sync removeIndex = me . indexOfKey ( keys [ i ] ) ; if ( removeIndex !== - 1 ) { if ( removeIndex < index ) { index -- ; } me . removeAt ( removeIndex ) ; } } me . resumeEvents ( ) ; // If we are appending and the indices are in sync, its cheap to kep them that way syncIndices = index === me . length && me . indexGeneration === me . generation ; // Insert the new items and new keys in at the insertion point Ext . Array . insert ( me . items , index , objects ) ; Ext . Array . insert ( me . keys , index , keys ) ; me . length += len ; me . generation ++ ; if ( syncIndices ) { me . indexGeneration = me . generation ; } for ( i = 0 ; i < len ; i ++ , index ++ ) { itemKey = keys [ i ] ; if ( itemKey != null ) { me . map [ itemKey ] = objects [ i ] ; // If the index is still in sync, keep it that way if ( syncIndices ) { me . indexMap [ itemKey ] = index ; } } if ( fireAdd ) { me . fireEvent ( 'add' , index , objects [ i ] , itemKey ) ; } } return objects ; }
Private multi insert implementation.
Private multi insert implementation .