I\'m looking for the most basic solution to create multiple indexes on a Java Collection.
Required functionality:
Your main goal seems to be that you'll remove the object from all indexes when you remove it from one.
The simplest approach will be to add another layer of indirection: you store your actual object in a Map, and use a bidirectional map (which you'll find in Jakarta Commons and probably Google Code) for your indexes as Map. When you remove an entry from a particular index, you'll take the Long value from that index and use it to remove the corresponding entries from the main map and the other indexes.
One alternative to the BIDIMap is to define your "index" maps as Map; however, this will require you to implement a ReferenceQueue for cleanup.
Another alternative is to create a key object that can take an arbitrary tuple, define its equals() method to match on any element in the tuple, and use that with a TreeMap. You can't use a HashMap, because you won't be able to compute a hashcode based on just one element of the tuple.
public class MultiKey
implements Comparable