Multiple indexes for a Java Collection - most basic solution?
Posted
by chris_l
on Stack Overflow
See other posts from Stack Overflow
or by chris_l
Published on 2010-03-23T15:57:32Z
Indexed on
2010/03/23
16:03 UTC
Read the original article
Hit count: 244
Hi,
I'm looking for the most basic solution to create multiple indexes on a Java Collection.
Required functionality:
- When a Value is removed, all index entries associated with that value must be removed.
- Index lookup must be faster than linear search (at least as fast as a TreeMap).
Side conditions:
- It should ideally work with JavaSE (6.0) alone - no extra libraries, if possible.
- If necessary, then only small (not something like Lucene), common and well tested libraries. No database!
Of course, I could write a class that manages multiple Maps myself. But 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.
Thanks, Chris
© Stack Overflow or respective owner