Re: Handling the throwable "ThreadDeath"
Eric Sosman wrote:
Lew wrote:
On Aug 25, 1:53 pm, Eric Sosman <Eric.Sos...@sun.com> wrote:
markspace wrote:
Eric Sosman wrote:
Neither HashTable nor StringBuffer is deprecated.
...
Java pun] percolate gently through source tree. And I'm not at all sure
I'd encourage wholesale changing of HashTable to HashMap
I presume you mean 'Hashtable' rather than 'HashTable'.
See what I said about non-zero risk? See? See?!!!
Well, if you did a wholesale search-and-replace of 'HashTable' to 'HashMap'
and the code hadn't used 'HashTable' but 'Hashtable' to begin with, you
wouldn't be introducing too much additional risk to your code.
Kidding aside, 'HashMap' is a close enough workalike to 'Hashtable' absent
multi-threaded concerns, as long as you take the extra step to convert any
associated 'Enumeration' into an 'Iterable' and replace any lost methods
('contains()', etc.). If the 'Map' is shared, you would want the
'Collections.synchronizedMap()' of it, or perhaps 'ConcurrentHashMap' (which
covers 'Hashtable' functionality, too, interestingly enough).
While Sun doesn't deprecate it, it does say about 'Hashtable's parent class,
'Dictionary', "This class is obsolete. New implementations should implement
the Map interface, rather than extending [sic] this class."
Personally I believe that we should all get rid of these obsolescent types -
HashMap, Vector, Enumeration, Dictionary - in favor of the replacement
Collection types. I'm smart enough to accept "where and when feasible".
--
Lew