title: How to Delete All Elements That Have an Even Index in Java ArrayList
body: <p>I'm trying to write a method that removes all ArrayList elements that have an even index. I would like to accomplish this without using any auxiliary data structures. I'm thinking that I should set all even index items to null. Then, I'll try to remove all null elements. </p>
  
  <p><strong>Example:</strong> </p>
  
  <pre><code>{1, 2, 3, 4, 5, 6}
  </code></pre>
  
  <p>Should change to this </p>
  
  <pre><code>{1, 3, 5} 
  </code></pre>
  
  <p>I was able to find the even positions, but I still can't figure out how to remove them from the ArrayList.</p>
  
  <pre><code>public void removeEvenElems() {
  
      for (int i = 0; i &lt; size; i++) {
          if (i % 2 == 0) {
              //how to delete array[i] ?
  
          }
      } 
  }
  </code></pre>