function struct(key, value, cursor){
  this.key = key;
  this.value = value;
  this.cursor = cursor;
 }


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 struct(key, value, this.map.length);
}
function push(key, value){
  this.map[this.map.length] = new struct(key, value, this.map.length);
}
function get(key){
  for (var i = 0; i < this.map.length; i++){
    if ( this.map[i].key === key ){
      this.index=i+1;
      return this.map[i].value;
    }
  }
  return null;
}
function remove(key){
  for (var i = 0; i < this.map.length; i++){
    if(this.map[i].key === key){
    	this.map.splice(i,1);
    	break;
    }
  }
}
function removeTop(){
 	this.map.shift();
}

function size(){
  return this.map.length;
}

function isEmpty(){
  return this.map.length <= 0;
}
function iterator(){
	this.index=0;
	return this;
}
function hasNext(){
	if(this.map.length<=0) return false;	
	return this.index<this.map.length;
}
function next(){
	return this.map[this.index++].value;
}
function nextObj(){
	return this.map[this.index++];
}
function iterator(){
	this.index=0;
	return this;
}

function classMap() {

  this.map = new Array();
	this.index=0;
  this.get = get;
  this.put = put;
  this.push = push;
  this.remove = remove;
  this.size = size;
  this.isEmpty = isEmpty;
  this.iterator = iterator;
  this.hasNext = hasNext;
  this.removeTop =removeTop;
  this.next = next;
  this.nextObj = nextObj;
}
