title: What is the Best Way to Store some data in Java? (Array vs ArrayList)
body: <p>So currently, I am extracting two different attributes from an XML file in java that (for my project) are related to each other and just printing them out to the console. However, I want to be able to store these in a way in which referencing one value will retrieve it's corresponding counterpart. For example:</p>
  
  <pre><code>Id: rId11 &amp; Target: image3
  Id: rId10 &amp; Target: image2
  Id: rId9 &amp; Target: image1
  </code></pre>
  
  <p>With those 3 values, I'd want a way to store each line, but when I reference "rId" I could get it's corresponding "Target" value. I was thinking about using either an array or an arrayList, but I'm not really sure which would be better for my purposes or how exactly I would go about referencing only one value and getting the other. Could anyone offer me some advice? Thank you in advance.</p>