title: What Iterator.next() method do inside a for statement when used with java.util.Queue?
body: <p>For example:</p>
  
  <pre class="lang-java prettyprint-override"><code>public class Test {
  
      public static void main(String[] args) {
          Queue&lt;String&gt; names = new LinkedList&lt;&gt;(Arrays.asList("First", "Middle", "Last"));
          System.out.println("Queue before the loop: " + names);
  
          System.out.println("Printing loop...");
          for (Iterator&lt;String&gt; i = names.iterator(); i.hasNext();) {
              String name = i.next();
              System.out.println(name);
          }
  
          System.out.println("Queue after the loop: " + names);
      }
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre class="lang-none prettyprint-override"><code>Queue before the loop: [First, Middle, Last]
  Printing loop...
  First
  Middle
  Last
  Queue after the loop: [First, Middle, Last]
  </code></pre>
  
  <p>I know how the next() method traverse the <em>LinkedList</em>. But when it is called on a <em>Queue.iterator()</em> like, <code>i.next()</code> what does it do? <br/><br/>As you can see from the output it haven't removed any element from the queue. <br/><em>which I thought would be the case, since Queue only have <code>remove()/poll()</code>.</em></p>