1.var AUIMap=function(){
   var table=[""];
   this.set=function(k,v){
   if(k===null) return putForNullKey(v);
     for(var i=1;i<table.length;i++)
   { 
   if(table[i].getKey()===k)
   return table[i].setValue(v);
   }
   addEntry(k,v,table.length);
   return null;
}
    this.get=function(k){
     if(k===null) return getForNullKey();
     for(var i=1;i<table.length;i++)
     {
     if(table[i].getKey()===k)
     return table[i].getValue();
     }
     return null;
    }
    this.remove=function(key){
     if(key===null)
     if(table[0] instanceof Entry)
     { var temp= table[0];
     table[0]="";
     return temp.value;
     }
     else
     return null;
     for(var i=1;i<table.length;i++)
     {
     if(table[i].getKey()===key)
     {
     return table.splice(i,1)[0].getValue();
     }   
      }
     return null;      
    }
    this.toString=function(){  
     var str="";
if(table[0] instanceof Entry)
str+=stable[0].toString()+",";
  for(var i=1;i<table.length;i++)
 str+=table[i].toString()+",";
return str;
    }
    this.isEmpty=function(){
        if(table[0] instanceof Entry)
         return false;
        else return table[1]instanceof Entry ?false:true; 
    
    }
    this.clear=function(){
     table.length=1;
     table[0]="";
    }
    this.containsKey=function(key){
     if(key===null) 
     return table[0] instanceof Entry ?true:false;
     for(var i=1;i<table.length;i++)
     {
     if(table[i].getKey()===key) 
     return true;
     }
     return false;
    }
    var getForNullKey=function(){
      if(table[0] instanceof Entry)
 return table[0].getValue();
 else 
return null;     
   }
   var putForNullKey=function(value){
         if(table[0] instanceof Entry)
  return table[0].setValue(value);
addEntry(null,value,0);
return null;
  }                     
   var  addEntry=function(key,value,bucketIndex){
   table[bucketIndex]=new Entry(key,value);
   }
this.each = function(fun){
  if(table[0] instanceof Entry)
   fun(table[0]);
for(var i=1;i<table.length;i++){
fun(table[i]);
}
}
    this.size=function(){ if(table[0] instanceof Entry)
                           return table.length;
                           else
                           return table.length-1;
                        }
    this.keySet=function(){
     var keys=[];
     if(this.containsKey(null))
     keys[0]=null;
     for(var i=1;i<table.length;i++)
        keys[i]=table[i].getKey();
     if(keys[0]===null)
     return keys;
     else 
     return keys.slice(1);   
    }
                
   //Entry inner class                                                                   
   var Entry= function (key,value){
   var key=key;
  
   var value=value;
   this.getKey  =function(){return key;}
   this.getValue=function(){return value;}
   this.setValue=function(v){
                            var oldvalue=value;
                            value=v;
                  return oldvalue;
                  }
    this.toString=function(){
                  return key+":"+value;
                     }
   }
   }
/*var map=new AUIMap();
  
   map.set("null","b");
  
  
   map.set("c","cccc");*/
2.var AUISet=function(){
   var map=new AUIMap();
   var obj={};
   //if this set did not already contain the specified element,return true
   this.add=function(o){
   return map.set(o,obj)==null;
     
   }
   this.contains=function(o){
   return map.containsKey(o);
   }
   this.clear=function(){
   map.clear();
   }
   this.size=function(){
   return map.size();
   }
   //if the set contained the specified element,return true;
   this.remove=function(o){
   return map.remove(o)===obj;
   }
   this.isEmpty=function(){
   return map.isEmpty();
   }
   this.toString=function(){
    var str="";
    var arr=map.keySet();
     for(var i=0;i<arr.length;i++)
        str+=arr[i]+",";
    return str;
   }
   }
/*var set=new AUISet();
   set.add(1);
   set.add(2);
   set.add("ddf");
   set.clear();
   alert(set.remove(1));*/