title: Iterator.remove() IllegalStateException
body: <p>In the code below I have a try catch block that attempts to remove an element from a Vector, using Iterator. I've created my own class <code>QueueExtendingVect</code> that extends <code>Vector</code> and implements <code>Iterator</code>. </p>
  
  <p>The variable <code>qev1</code> is an instance of class <code>QueueExtendingVect</code>. I've already added a few elements to this Vector as well. </p>
  
  <pre><code>try 
  {
     qev1.iterator().remove();
  }
  catch(UnsupportedOperationException e) 
  {
     System.out.println("Calling Iterator.remove() and throwing exception.");
  }
  
  qev1.enqueue(ci); 
  qev2.enqueue(ci);
  qcv1.enqueue(ci);
  qcv2.enqueue(ci);
  
  for (int i = 1; i &lt; 5; i++)
  {
     if (i % 2 == 0)
     {
         qev1.enqueue(new CInteger(i+1));
         qev2.enqueue(new CInteger(i+1));
         qcv1.enqueue(new CInteger(i+1));
         qcv2.enqueue(new CInteger(i+1));
     } 
     else 
    { 
         qev1.enqueue(new Date(i*i));
         qev2.enqueue(new Date(i*i));
         qcv1.enqueue(new Date(i*i));
         qcv2.enqueue(new Date(i*i));
     }
  }
  </code></pre>
  
  <p>In this code I add a few elements to the Vector qev1. The other variables are in other parts of the code.</p>
  
  <p>However, when I run my program I get an IllegalStateException at runtime. I'm not sure what this means.</p>