Remember that Iterator is an interface, and there are many different implementations within the
Java APIs. Each implementation can choose whether or not to implement remove(). If you're getting that exception, then the implementation used in your particular situation doesn't support remove(). The only thing you can really do is to use a different collection class, one whose iterator does support remove().