Re: Ranking
Crouchez wrote:
Can I use a hashtable type for this?
"Lew" <lew@lewscanon.com> wrote in message
Also, watch out for the term "hash table" in Java; it might lead you to
use java.util.Hashtable, which would be suboptimal in most cases. Declare
the variable as Map when such things are needed, and pick the appropriate
implementation thereof, such as HashMap, or very rarely, Hashtable.
Similarly with Vector vs. ArrayList.
why rarely hashtable? - it's auto synchronized which is a big help
That's "Hashtable", not "hashtable". You hadn't previously stated a need for
synchronization, so of course I spoke to the general case.
Hashtable isn't even necessarily the best synchronized Map because of
non-Collection methods it still supports.
You can use Collections.synchronizedMap( someMap ) for better safety.
Or use Hashtable. Notice that I said it's "suboptimal in most cases", not "in
all cases".
Are you writing multi-threaded code that shares the Map, then?
--
Lew