@Override
	public E set(int i, E e) throws IndexOutOfBoundsException {
		if (i < 0 || i > size)
			throw new IndexOutOfBoundsException();

		E element = null;

		if (i + 1 > size) {
			size++;
			if (size > capacity)
				growArray();
		} else {
			element = elements[getIndex(i)];
		}

		elements[getIndex(i)] = e;
		return element;
	}