var Map = function(){
this._entrys = new 정렬();
this.put = 함수(키, 값){
if (키 == null || 키 == 정의되지 않음) {
return;
}
var index = this._getIndex(key);
if (index == -1) {
var item = new Object();
entry.key = 키;
항목.값 = 값;
this._entrys[this._entrys.length] = 항목;
}else{
this._entrys[index].value = value;
}
};
this.get = function(key){
var index = this._getIndex(key);
반환(색인 != -1) ? this._entrys[index].value : null;
};
this.remove = function(key){
var index = this._getIndex(key);
if (index != -1) {
this._entrys.splice(index, 1);
}
};
this.clear = function(){
this._entrys.length = 0;;
};
this.contains = function(key){
var index = this._getIndex(key);
반환(색인 != -1) ? 사실 : 거짓;
};
this.getCount = function(){
return this._entrys.length;
};
this.getEntrys = function(){
return this._entrys;
};
this._getIndex = function(key){
if (key == null || key == undefine) {
return -1;
}
var _length = this._entrys.length;
for (var i = 0; i < _length; i ) {
var item = this._entrys[i];
if (항목 == null || 항목 == 정의되지 않음) {
계속;
}
if (entry.key === key) {//equal
return i;
}
}
return -1;
};
this._toString = function(){
var string = "";
for (var i = 0; i < this.getEntrys().length; i ) {
string = this.getEntrys()[i].key "::" this.getEntrys()[i ].값;
if(i!=this.getEntrys().length-1){
string = ";";
}
}
문자열 반환;
};
};