title: Multiple indexes for a Java Collection - most basic solution?
body: <p>I'm looking for the most basic solution to create multiple indexes on a Java Collection.</p>
  
  <p>Required functionality:</p>
  
  <ul>
  <li>When a Value is removed, all index entries associated with that value must be removed.</li>
  <li>Index lookup must be faster than linear search (at least as fast as a TreeMap).</li>
  </ul>
  
  <p>Side conditions:</p>
  
  <ul>
  <li>No dependencies on large (like Lucene) libraries. No uncommon or not well tested libraries. No database.</li>
  <li>A library like Apache Commons Collections etc. would be ok.</li>
  <li>Even better, if it works with JavaSE (6.0) alone.</li>
  <li><strong>Edit:</strong> No self-implemented solution (thanks for the answers suggesting this - it's good to have them here for completeness, but I already have a solution very similar to Jay's) <em>Whenever several people find out, that they implemented the same thing, this should be part of some common library.</em></li>
  </ul>
  
  <p>Of course, I could write a class that manages multiple Maps myself <em>(that's not hard, but it feels like reinventing the wheel)</em>. So I'd like to know, if it can be done without - while still getting a simple usage similar to using a single indexed java.util.Map. </p>
  
  <p>Thanks, Chris</p>
  
  <h2>Update</h2>
  
  <p>It looks very much as if we haven't found anything. I like all your answers - the self developed versions, the links to database-like libraries.</p>
  
  <p>Here's what I really want: To have the functionality in (a) Apache Commons Collections or (b) in Google Collections/Guava. Or maybe a very good alternative.</p>
  
  <p>Do other people miss this functionality in these libraries, too? They do provide all sorts of things like MultiMaps, MulitKeyMaps, BidiMaps, ... I feel, it would fit in those libraries nicely - it could be called <code>MultiIndexMap</code>. What do you think?</p>