In Java, I am looking for a collection that will test if a given element is in a set, using the equal() method defined for the element. If it is in the set, I need the collection to give me the actual occurrence of the object from the set. Vector will do this for me via the indexOf() method, but the problem is that the search function in Vector is too slow. TreeSet will do the test for elementhood but won't retrieve the object. I also need to add additional objects to this set fairly regularly (a few tens of thousands of objects). I don't think the Java API has anything that does exactly what I want, but maybe there is another API that does? I'd rather not implement it myself.