class ComposedIterator<E> implements Iterator<E> {

        private final List<Iterator<E>> elements;

        private int currIndex;

        ComposedIterator(List<Iterator<E>> elements) {
            this.elements = elements;
            currIndex = 0;
        }

        @Override
        public boolean hasNext() {
            if (currIndex >= elements.size()) {
                return false;
            }
            if (elements.get(currIndex).hasNext()) {
                return true;
            }
            currIndex++;
            return hasNext();
        }

        @Override
        public E next() {
            if (!hasNext()) {
                throw new IllegalArgumentException();
            }
            return elements.get(currIndex).next();
        }

        @Override
        public void remove() {
            elements.get(currIndex).remove();
        }
    }

    private static Iterator<TokenTextElement> reverseIterator(NodeText nodeText, int index) {<FILL_FUNCTION_BODY>

        TextElement textElement = nodeText.getTextElement(index);
        if (textElement instanceof TokenTextElement) {
            return new SingleElementIterator<TokenTextElement>((TokenTextElement) textElement) {

                @Override
                public void remove() {
                    nodeText.removeElement(index);
                }
            };
        }
            if (textElement instanceof ChildTextElement) {
            ChildTextElement childTextElement = (ChildTextElement) textElement;
            NodeText textForChild = childTextElement.getNodeTextForWrappedNode();
            return reverseIterator(textForChild);
        }
        throw new IllegalArgumentException();
    
<no_super_class>