src/aria/utils/StackHashMap.js
function (key, value) {
                var item = {
                    key : key,
                    value : value,
                    index : this._nextIndex
                };
                this._nextIndex++;
                var map = this._getMap(key, true);
                if (map == this._objectKeys) {
                    // something special in case of objects:
                    var next = key[this._metaDataName];
                    if (next) {
                        // the key is already present
                        // keep the old value
                        item.next = next;
                        // keep the index (so that the removal is unified between objects, strings and numbers)
                        item.index = next.index;
                    }
                    key[this._metaDataName] = item;
                } else if (map != this._otherKeys) {
                    item.index = key; // use the key as index for numbers and strings
                    item.next = map[item.index]; // keep any existing value
                } else {
                    // we must check for an existing value to define the 'next' property,
                    // so that the order when removing values is the one of a stack
                    for (var i in map) {
                        if (map.hasOwnProperty(i)) {
                            var elt = map[i];
                            if (key === elt.key) {
                                item.index = i;
                                item.next = elt;
                                break;
                            }
                        }
                    }
                }
                map[item.index] = item;
            }
function (key, value) {
                var item = {
                    key : key,
                    value : value,
                    index : this._nextIndex
                };
                this._nextIndex++;
                var map = this._getMap(key, true);
                if (map == this._objectKeys) {
                    // something special in case of objects:
                    var next = key[this._metaDataName];
                    if (next) {
                        // the key is already present
                        // keep the old value
                        item.next = next;
                        // keep the index (so that the removal is unified between objects, strings and numbers)
                        item.index = next.index;
                    }
                    key[this._metaDataName] = item;
                } else if (map != this._otherKeys) {
                    item.index = key; // use the key as index for numbers and strings
                    item.next = map[item.index]; // keep any existing value
                } else {
                    // we must check for an existing value to define the 'next' property,
                    // so that the order when removing values is the one of a stack
                    for (var i in map) {
                        if (map.hasOwnProperty(i)) {
                            var elt = map[i];
                            if (key === elt.key) {
                                item.index = i;
                                item.next = elt;
                                break;
                            }
                        }
                    }
                }
                map[item.index] = item;
            }
function ( key , value ) { var item = { key : key , value : value , index : this . _nextIndex } ; this . _nextIndex ++ ; var map = this . _getMap ( key , true ) ; if ( map == this . _objectKeys ) { // something special in case of objects: var next = key [ this . _metaDataName ] ; if ( next ) { // the key is already present // keep the old value item . next = next ; // keep the index (so that the removal is unified between objects, strings and numbers) item . index = next . index ; } key [ this . _metaDataName ] = item ; } else if ( map != this . _otherKeys ) { item . index = key ; // use the key as index for numbers and strings item . next = map [ item . index ] ; // keep any existing value } else { // we must check for an existing value to define the 'next' property, // so that the order when removing values is the one of a stack for ( var i in map ) { if ( map . hasOwnProperty ( i ) ) { var elt = map [ i ] ; if ( key === elt . key ) { item . index = i ; item . next = elt ; break ; } } } } map [ item . index ] = item ; }
Add an entry in the StackHashMap object.
@param {MultiTypes} key Key which can be used to retrieve the value later (through the pop method). If
the key is already present in the object, the value will be added anyway.
@param {MultiTypes} value Anything to store in the StackHashMap object
Add an entry in the StackHashMap object .