title: Fastest way to get the first n elements of a List into an Array
body: <p>What is the fastest way to get the first n elements of a list stored in an array?</p>
  
  <p>Considering this as the scenario:</p>
  
  <pre><code>int n = 10;
  ArrayList&lt;String&gt; in = new ArrayList&lt;&gt;();
  for(int i = 0; i &lt; (n+10); i++)
    in.add("foobar");
  </code></pre>
  
  <p><strong>Option 1:</strong></p>
  
  <pre><code>String[] out = new String[n];
  for(int i = 0; i&lt; n; i++)
      out[i]=in.get(i);
  </code></pre>
  
  <p><strong>Option 2:</strong></p>
  
  <pre><code>String[] out = (String[]) (in.subList(0, n)).toArray();
  </code></pre>
  
  <p><strong>Option 3:</strong>
  Is there a faster way? Maybe with Java8-streams?</p>