title: Which collection should be used to store xml files in memory?
body: <p>This question was posed to me in my interview with Adobe.  I answered hashmap can be used, but he was not satisfied.</p>
  
  <h1>File 1</h1>
  
  <pre><code>&lt; tag1 &gt;  
    &lt; subtag1 &gt;  
      &lt; subsubtag1 &gt;  
      &lt;/subsubtag1 &gt;  
    &lt; /subtag1 &gt;  
  &lt; /tag1 &gt;  
  &lt; tag2 &gt;  
  &lt; /tag2 &gt; 
  </code></pre>
  
  <p><em>n</em> numbers of such files (i.e XML files) need to be stored in memory. Write implementation for a java data structure which should be used to store these files in memory with an aim to efficiently perform following operations:</p>
  
  <ol>
  <li>access a particular tag in a particular file. </li>
  <li>access a particular tag in all the files in which that tag exists. </li>
  </ol>
  
  <p>Note:</p>
  
  <ol>
  <li>there are millions of files to be stored </li>
  <li>each file contains millions of tags and each tag may contain millions of subtags</li>
  </ol>