geting something out of hashset

Hello,How do I retrieve something out of a HashSet?If I use an Iterator I'll have to go through many other objects, besides the one I want....Thanks,--david
[192 byte] By [David04a] at [2007-11-27 9:41:32]
# 1
Well, how would you describe it?Does this help: http://java.sun.com/javase/6/docs/api/java/util/NavigableSet.html
BigDaddyLoveHandlesa at 2007-7-12 23:20:41 > top of Java-index,Java Essentials,New To Java...
# 2
I just wanted to search and retrieve:int posOrSomething = search(hash);Object o = get(posOrSomething);
David04a at 2007-7-12 23:20:41 > top of Java-index,Java Essentials,New To Java...
# 3

> Hello,

>

> How do I retrieve something out of a HashSet?

> If I use an Iterator I'll have to go through many

> other objects, besides the one I want....

>

> Thanks,

> --david

Don't put them in a Set, then. By the look of it, you want a Map

georgemca at 2007-7-12 23:20:41 > top of Java-index,Java Essentials,New To Java...
# 4
Thank you very much!Yes, thats what I want.BTW: then what's the use of a hash if you have to search it like an list (using the iterator)?
David04a at 2007-7-12 23:20:41 > top of Java-index,Java Essentials,New To Java...
# 5
> BTW: then what's the use of a hash if you have to search it like an list (using the iterator)?Of a HashSet? Well, I've used Sets and never had to search them.
BigDaddyLoveHandlesa at 2007-7-12 23:20:41 > top of Java-index,Java Essentials,New To Java...
# 6
hashsets are great if you need something to do, well, set operations.
petes1234a at 2007-7-12 23:20:41 > top of Java-index,Java Essentials,New To Java...
# 7
Ok, I see, thanks!
David04a at 2007-7-12 23:20:41 > top of Java-index,Java Essentials,New To Java...
# 8
> Thank you very much!> Yes, thats what I want.> > BTW: then what's the use of a hash if you have to> search it like an list (using the iterator)?What's the use of a box of nails if you have to look for a specific one?
georgemca at 2007-7-12 23:20:41 > top of Java-index,Java Essentials,New To Java...