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:
- Is there a better way to approach this?
- If Hashtable is the only
usable class for this (in my opinion) reasonably important library
call, on what basis is it “obsolete”?
Thanks!
The reason Hashtable is obsolete is because it was was replaced with Hashmap.
However, for the purposes of assigning labels to a setLabelTable, the “deficiencies” of Hashtable are not a problem.