@Override
    public void set(SpanNode spanNode) {
        if (stack.isEmpty()) {
            throw new IllegalStateException();
        }
        if (iteratorFromLastCallToNext != null) {
            iteratorFromLastCallToNext.set(spanNode);
        } else {
            throw new IllegalStateException();
        }
    }
ListIterator implementation which performs a depth-first traversal of SpanNodes.

@author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a>
document/src/main/java/com/yahoo/document/annotation/RecursiveNodeIterator.java