e.next = this.table[j];
this.table[j] = e;
e = next;
} while (e != null);
}
}
}
HashMap.prototype.indexFor=function(h) {
var index= h & (this.len-1);
return index;
}
HashMap.prototype.size=function() {
return this.length;
}
HashMap.prototype.isEmpty=function() {
return this.length == 0;
}
HashMap.prototype.get=function(key) {
var hash =HashMap.hash(key);
var i = this.indexFor(hash);
var e = this.table[i];
while (true) {
if (e ==null)
return null;
if (e.hash == hash && key.equals(e.key))
return e.value;
e = e.next;
}
}
HashMap.prototype.containsKey=function(key) {
var hash =HashMap.hash(key);
var i = this.indexFor(hash);
var e = this.table[i];
while (e != null) {
if (e.hash == hash && key.equals(e.key))
return true;
e = e.next;
}
return false;
}
HashMap.prototype.put=function(key,value) {
var hash = HashMap.hash(key);
var i = this.indexFor(hash);
for (var e = this.table[i]; e != null; e = e.next) {
if (e.hash == hash && key.equals(e.key)) {
var oldValue = e.value;
e.value = value;
return oldValue;
}
}
this.addEntry(hash, key, value, i);
var r=Math.ceil(this.length * 1.5);
if(r > this.len){
this.len= this.len << 1;
this.rehash();
}
return null;
}
HashMap.prototype.putAll=function (map){
var mod=false;
for(var it=map.iterator();it.hasNext();){
var e=it.next();
if(this.put(e.getKey(),e.getValue())) mod=true;
}
}
HashMap.prototype.remove=function(key) {
var e = this.removeEntryForKey(key);
return (e ==null ? null : e.value);
}
HashMap.prototype.removeEntryForKey=function(key) {
var hash = HashMap.hash(key);










