Is the value fixed for any given instance of the object ? If so you could use a HashMap with the value as a key. If it was possible for more than one instance to have the same value then you would need to maintain a list of instances mapped to each key, but retrieving the first instance with a given value would simply be a case of retrieving the list from the HashMap and then getting the first entry in the list.
Edit - I just noticed you wanted the index of the entry rather than the entry itself, so I don't think the HashMap idea would work as the order of entry is not maintained. [ August 15, 2008: Message edited by: Joanne Neal ]
Originally posted by Pakawat Gibson LP: Thanks guy.
So there is no way to access/get that object out without iteration?
If you don't know the index postition, or can't easily determine what the index postition should be (using some kind of hashing algorithm), not really. You might be able to optimize the process using sort and search algorithms, but that's about it. [ August 15, 2008: Message edited by: Jelle Klap ]
Pakawat Gibson LP
Joined: Jul 23, 2008
I'm not the guy on Computer Science for real, just a super newbie who wants to learn programming. So... I might need to seriously study Data Structure around.