title: For-each vs Iterator. Which will be the better option
body: <p>Consider the following scenario. </p>
  
  <pre><code>List&lt;String&gt; list = new ArrayList&lt;&gt;();
  </code></pre>
  
  <p>Now I added the <code>String</code> values for this list. </p>
  
  <p>I used following ways to go each and every element in the list.</p>
  
  <p>Option one- use <code>for-each</code></p>
  
  <pre><code>for (String i : list) {
          System.out.println(i);
      } 
  </code></pre>
  
  <p>Option two- use <code>Iterator</code></p>
  
  <pre><code>Iterator it=list.iterator();
  while (it.hasNext()){
     System.out.println(it.next());
  }
  </code></pre>
  
  <p>I just want to know is there any performance advantage if I use <code>for-each</code> instead of <code>Iterator</code>. And also is it a bad practice to use Iterator now a days in Java?</p>