I'm a bit surprised no one has asked about this specific case, cause it's kind of a weird inconsistency in the java standard libraries:
I'm using swing JSliders with custom labels; the only library call available to assign labels is: setLabelTable(Dictionary labels)
But Dictionary is an abstract class, and its only known subclass in the standard lib is Hashtable, which the api & various IDE's complain about because it's "obsolete."
The obvious thing to do is just use the Hashtable, but I'm wondering two things:
Thanks!
It is obsolete because it has been replaced with java.util.HashMap. The primary differences are that methods on HashTable are synchronized, and HashMap allows use of the null pointer as a key.
Modern versions of java have come a long way in the performance of un-contested synchronized operations, so there isn't really the performance concern that there used to be. (if you're running on up to date JDK on a major platform.) If an API requires a HashTable, go ahead and use it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With