title: removing elements while iterating the Collection
body: <p>I read that the correct way of  removing elements while iterating the Collection, is this way (using iterator):</p>
  
  <pre><code>List&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;();
  list.add(12);
  list.add(18);
  
  Iterator&lt;Integer&gt; itr = list.iterator();
  
  while(itr.hasNext()) {
      itr.remove();
  }
  </code></pre>
  
  <p>But, I receive <code>Exception in thread "main" java.lang.IllegalStateException</code> and I don't know why.
  Can someone help me?</p>