class NodeListIterator implements ListIterator<N> {

        ListIterator<N> iterator;

        N current = null;

        // initialize pointer to head of the list for iteration
        public NodeListIterator(List<N> list) {
            iterator = list.listIterator();
        }

        public NodeListIterator(List<N> list, int index) {
            iterator = list.listIterator(index);
        }

        @Override
        public boolean hasNext() {
            return iterator.hasNext();
        }

        @Override
        public N next() {
            current = iterator.next();
            return current;
        }

        @Override
        public boolean hasPrevious() {
            return iterator.hasPrevious();
        }

        @Override
        public N previous() {
            current = iterator.previous();
            return current;
        }

        @Override
        public int nextIndex() {
            return iterator.nextIndex();
        }

        @Override
        public int previousIndex() {
            return iterator.previousIndex();
        }

        @Override
        public void remove() {
            int index = innerList.indexOf(current);
            if (index != -1) {
                notifyElementRemoved(index, current);
                current.setParentNode(null);
            }
            iterator.remove();
        }

        @Override
        public void set(N n) {<FILL_FUNCTION_BODY>}

        @Override
        public void add(N n) {
            notifyElementAdded(innerList.size(), n);
            own(n);
            iterator.add(n);
        }

        @Override
        public void forEachRemaining(Consumer<? super N> action) {
            iterator.forEachRemaining(action);
        }
    }

            int index = innerList.indexOf(current);
            if (index < 0 || index >= innerList.size()) {
                throw new IllegalArgumentException("Illegal index. The index should be between 0 and " + innerList.size() + " excluded. It is instead " + index);
            }
            if (n != innerList.get(index)) {
                notifyElementReplaced(index, n);
                innerList.get(index).setParentNode(null);
                setAsParentNodeOf(n);
                iterator.set(n);
            }
        
<no_super_class>