function
pair(key, value) {
this .key = key;
this .value = value;
}
function put(key, value) {
for ( var i = 0 ; i < this .map.length; i ++ ) {
if ( this .map[i].key == key) {
this .map[i].value = value;
return ;
}
}
this .map[ this .map.length] = new pair(key, value);
}
function get(key) {
for ( var i = 0 ; i < this .map.length; i ++ ) {
if ( this .map[i].key == key)
return this .map[i].value;
}
}
function remove(key) {
for ( var i = 0 ; i < this .map.length; i ++ ) {
if ( this .map[i].key == key) {
for ( var j = i; j < this .map.length - 1 ; ++ j)
this .map[j] = this .map[j + 1 ];
return ;
}
}
}
function getCount(){
return this .map.length;
}
function isEmpty(){
return this .map.length == 0 ;
}
function classMap() {
this .map = new Array();
this .get = get;
this .put = put;
this .remove = remove;
this .getCount = getCount;
this .isEmpty = isEmpty;
}
this .key = key;
this .value = value;
}
function put(key, value) {
for ( var i = 0 ; i < this .map.length; i ++ ) {
if ( this .map[i].key == key) {
this .map[i].value = value;
return ;
}
}
this .map[ this .map.length] = new pair(key, value);
}
function get(key) {
for ( var i = 0 ; i < this .map.length; i ++ ) {
if ( this .map[i].key == key)
return this .map[i].value;
}
}
function remove(key) {
for ( var i = 0 ; i < this .map.length; i ++ ) {
if ( this .map[i].key == key) {
for ( var j = i; j < this .map.length - 1 ; ++ j)
this .map[j] = this .map[j + 1 ];
return ;
}
}
}
function getCount(){
return this .map.length;
}
function isEmpty(){
return this .map.length == 0 ;
}
function classMap() {
this .map = new Array();
this .get = get;
this .put = put;
this .remove = remove;
this .getCount = getCount;
this .isEmpty = isEmpty;
}