title: Java 8 Speed test by Simple Print List
body: <pre><code>import java.util.ArrayList;
  import java.util.List;
  
  
  public class HowFastMulticoreProgramming {
  
      public static void main(String[] args) {
  
          //Produce Date
          List&lt;String&gt; data=new ArrayList&lt;String&gt;();
          for(int i=0;i&lt;10000;i++){
              data.add(""+i);
          }
  
  
          /*Style Java 1.4*/
          long beforeStartJDK14=System.currentTimeMillis();
          for (int i = 0; i &lt; data.size(); i++) {
              System.out.println(data.get(i));
          }
          long afterPrintJDK14=System.currentTimeMillis();
  
          /*Style Java 1.5*/
          long beforeStartJDK15=System.currentTimeMillis();
          for (String s : data) {
              System.out.println(s);
          }
          long afterPrintJDK15=System.currentTimeMillis();
  
          long beforeStartJDK18=System.currentTimeMillis();
          data.parallelStream().forEach(string-&gt; System.out.println(string));
          long afterPrintJDK18=System.currentTimeMillis();
  
          System.out.println("Milis Need JDK 1.4 : "+(afterPrintJDK14-beforeStartJDK14));
          System.out.println("Milis Need JDK 1.5 : "+(afterPrintJDK15-beforeStartJDK15));
          System.out.println("Milis Need JDK 1.8 : "+(afterPrintJDK18-beforeStartJDK18));
  
      }
  }
  </code></pre>
  
  <p>I Have 3 styles to print List (based on JDK version). but every Styles need time to complete. In fact style jdk 8 with lambdas.. neeeded greater with any styles.
  how come?</p>
  
  <p>This is what I get from running this code;
  Time Milis Need JDK 1.4 : 85
  Time Milis Need JDK 1.5 : 76
  Time Milis Need JDK 1.8 : 939</p>
  
  <p>I hope somebody can answer this question.</p>