public TreePVector<E> with(int index, E element) {
        if (index < 0 || index >= size())
            throw new IndexOutOfBoundsException();

        IntTreePMap<E> map = this.map.plus(index, element);
        if (map == this.map)
            return this;
        return new TreePVector<E>(map);
    }