protected void updateCurrentIterator() {
        if (currentIterator == null) {
            if (iteratorChain.isEmpty()) {
                currentIterator = EmptyIterator.INSTANCE;
            } else {
                currentIterator = iteratorChain.get(0);
            }
            // set last used iterator here, in case the user calls remove
            // before calling hasNext() or next() (although they shouldn't)
            lastUsedIterator = currentIterator;
        }

        while (!currentIterator.hasNext() && currentIteratorIndex < iteratorChain.size() - 1) {
            currentIteratorIndex++;
            currentIterator = iteratorChain.get(currentIteratorIndex);
        }
    }
Updates the current iterator field to ensure that the current Iterator
is not exhausted
jphp-runtime/src/php/runtime/common/collections/iterators/IteratorChain.java