Sudsy said:
There's java.util.HashSet but it's backed by a HashMap so why not
just use a HashMap and set the value to null?
Correction: in the current version of the Sun implementation of the Java
API, HashSet is backed by a HashMap. That's certainly not specified
behavior.
One good reason not to use a HashMap and set the value to null is that
it seems almost like an intentional effort to obscure the purpose of the
code. If you want a set of something, you ought to be using a Set, not
a Map. It's beyond me why the implementation of that Set would matter
to you, except for performance reasons. I have yet to see any
indication that HashSet fails to perform well, or that a different
implementation would perform substantially better in any situation at
all.
--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation