function ArrayList()
{
	this.current = 0;
	this.list = [];
}

ArrayList.prototype = new Iterator();

ArrayList.prototype.add = function (item) {
	this.list.push(item);
}

ArrayList.prototype.contains = function (needle) {
	var length = this.length();
	for (var i = 0; i < length; i++) {
		if (this.list[i] == needle) {
			return true;
		}
	}
	return false;
}

ArrayList.prototype.remove = function (remove) {
	var list = [];
	for (var i = 0; i < length; i++) {
		if (this.list[i] != remove) {
			list.push(this.list[i]);
		}
	}
	
	this.list = list;
}



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

ArrayList.prototype.length = function () {
	return this.list.length;
}

ArrayList.prototype.getIterator = function () {
	return new ArrayListIterator(this);
}

// Implement Iterator
function ArrayListIterator(arrayList) {
	this.list = arrayList.list;

	this.current = 0;
}
ArrayListIterator.prototype.hasNext = function () {
	if (typeof this.list[this.current] != 'undefined') {
		return true;
	} else {
		return false;
	}
}

ArrayListIterator.prototype.next = function () {
	var item = this.list[this.current];
	this.current++;
	return item;
}

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