<p>Let's say I have <strong>a <code>List</code> object</strong> and <strong>an iterator</strong> for that list.</p>

<p>Now I sort the list with <code>java.util.Collections.sort()</code></p>

<ul>
<li>What happens to the iterator? </li>
<li>Is its behavior still defined and can it still be used? </li>
<li>If not, can I prevent destroying the iterators for the list?</li>
</ul>

<p>I know, this problem could be circumvented by changing the program design, cloning the list for example, but I specificly want to know the "official" behavior of Java.</p>

Iterators are generally invalid after
any
modification to their underlying collections, except via the iterator itself. (For instance,
```
ListIterator
```
allows for insertion and removal.)
I'd certainly expect any iterators to become invalidated after a sort though - and if they weren't, I'd have no idea what order to expect.