<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">import java.util.*;

public class StringSetIterator implements Iterator {
    private int position = 0;
    private StringSet object;
    private String[] data;
    
    //Constructor
    public StringSetIterator(StringSet s, String[] a) {
	object = s;
	data = a;
    }
    
    public boolean hasNext() {
	return position != object.size();
    }
    
    public Object next() {
	if (hasNext()) {
	    return data[position++];
	} else {
	    throw new NoSuchElementException();
	}
    }

    /* remove() deletes the element most recently returned by next(). */
    public void remove() {
	if (position != 0) {
	    object.remove(data[--position]);
	} else {
	    throw new IllegalStateException();
	}
    }
}
</pre></body></html>