How to use Class Dictionary in java ?
+2
A:
Look at java.util.HashMap and java.util.Map (I understand you are looking for a dictionary equivalent in Java, and not referring to the abstract Dictionary class which is implemented by HashTable)
Narayan Raman
2009-07-21 09:50:41
I know this but need implementation .
SjB
2009-07-21 09:51:52
HashMap *is* an implementation of the Map interface.
Michael Borgwardt
2009-07-21 10:02:06
+4
A:
Don't use it, it's profoundly, thoroughly, obsolete and unnecessary.
Use a Map implementation such as HashMap.
skaffman
2009-07-21 09:51:33
+1
A:
You can use a Hashtable. It extends the Dictionary class.
As for everyone who says it is obsolete, it probably should be but isn't. It is used in the current OSGi api in the class ServiceRegistration, and OSGi is somewhat popular these days ;-)
Of course, since Hashtable also implements Map, at least you can treat as one in your own code and still pass it in via the OSGi api as needed.
Robin
2009-07-21 12:47:42