function ArrayMap() {
	this.map = [];
	this.iteratorMap = [];
	this.size = 0;
}

ArrayMap.prototype.put = function (key, value) {
	this.map[key] = value;
	this.iteratorMap.push(key);
	this.size++;
}

ArrayMap.prototype.containsKey = function (key) {
	return (typeof this.map[key] != 'undefined');
}

ArrayMap.prototype.remove = function (key) {
	if (this.containsKey (key)) {
		delete this.map[key];
		this.size--;
	}
	
	var iteratorMap = [];
	var size = this.iteratorMap.size;
	for (var i = 0; i < size; i++) {
		if (this.iteratorMap[i] != key) {
			iteratorMap.push(this.iteratorMap[i]);
		}
	}
	this.iteratorMap = iteratorMap;
}

ArrayMap.prototype.get = function (key) {
	if (this.containsKey (key))
		return this.map[key];
	
	return null;
}

ArrayMap.prototype.isEmpty = function () {
	return this.length() == 0;
}

ArrayMap.prototype.length = function () {
	return this.size;
}

ArrayMap.prototype.getIterator = function () {
	return new ArrayMapIterator(this);
}

// Implement Iterator
function ArrayMapIterator(arrayMap) {
	this.map = arrayMap.map;
	this.iteratorMap = arrayMap.iteratorMap;

	this.current = 0;
}

ArrayMapIterator.prototype.hasNext = function () {
	if (typeof this.map[this.iteratorMap[this.current]] != 'undefined') {
		return true;
	} else {
		return false;
	}
}

ArrayMapIterator.prototype.next = function () {
	var item = this.map[this.iteratorMap[this.current]];
	this.current++;
	return item;
}

ArrayMapIterator.prototype.reset = function () {
	this.current = 0;
}