Design and implement a resumable iterator — an iterator that supports pausing and resuming from a saved checkpoint. The iterator must expose three core methods: next() (returns the next element), getState() (returns a serializable state object representing the current position), and setState(state) (restores the iterator to a previously saved state).…