public void set(E obj) {
        if (this.lastItemIndex == -1) {
            throw new IllegalStateException("must call next() or previous() before a call to set()");
        }

        this.array[this.lastItemIndex] = obj;
    }
Sets the element under the flow.
<p/>
This method sets the element that was returned by the last call
to {@link #next()} of {@link #previous()}.
<p/>
<b>Note:</b> {@link java.util.ListIterator} implementations that support <code>add()</code>
and <code>remove()</code> only allow <code>set()</code> to be called once per call
to <code>next()</code> or <code>previous</code> (see the {@link java.util.ListIterator}
javadoc for more details). Since this implementation does not support
<code>add()</code> or <code>remove()</code>, <code>set()</code> may be
called as often as desired.

@param obj the object to set into the array
@throws IllegalStateException if next() has not yet been called.
@throws ClassCastException    if the object type is unsuitable for the array
jphp-runtime/src/php/runtime/common/collections/iterators/ObjectArrayListIterator.java