1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

JAVA indexOf() method

  1. Apr 30, 2006 #1

    0rthodontist

    User Avatar
    Science Advisor

    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.
     
    Last edited: Apr 30, 2006
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you help with the solution or looking for help too?