title: Get index of newly added item in a list?
body: <p>I want to get the index of a newly added element into an arraylist. e.g. </p>
  
  <pre><code>List listA = new ArrayList();
  
  // Lots of code adding and removing things from `listA`, imagine `listA` now 
  // contains approx 10,000 records
  
  listA.add("element 0");
  </code></pre>
  
  <p>How do I find out the index of the newly added item?</p>
  
  <p>I think that perhaps, I need a different data structure, but cannot think of what to use.</p>