class NodeIterator implements Iterator<Node> {

        private Node node;
        private final Node end;

        private NodeIterator(Node first, Node end) {
            node = first;
            this.end = end;
        }

        @Override
        public boolean hasNext() {
            return node != null && node != end;
        }

        @Override
        public Node next() {<FILL_FUNCTION_BODY>}

        @Override
        public void remove() {
            throw new UnsupportedOperationException("remove");
        }
    }

            Node result = node;
            node = node.getNext();
            return result;
        
<no_super_class>