title: How can I add elements to an ArrayList at even or odd positions?
body: <p>I have two methods that populate one ArrayList and I want one of the methods to add elements at even positions while the other adds elements in odd positions, so that I get  an interleaved list of data.</p>
  
  <p>How can I add elements in even or odd positions?</p>
  
  <pre><code>for (int i = 0; i &lt; mData.size(); i++) {
       myList.add( ,mData.get(i))
  {
  </code></pre>
  
  <p><strong>Clarification. I don't need a list of even or odd numbers I need to get the next even or odd number from my variable <code>i</code> in the for loop. ie for <code>i</code> to <code>mdata.size()</code> store elements only in even places even if it exceeded the size of <code>mData</code> which it will</strong></p>