I have some old 3rd party Java code I am converting to Java 6. It contains HashTable instances, which are flagged as obsolete collections. What should I replace them with? What is the safest option?
I have some old 3rd party Java code I am converting to Java 6.
Share
Although not marked as deprecated in the API doc,
HashTableis obsolete, you could consider useHashMap.For the differences, you could check this post.
The main differences (the two that the doc said) are:
HashMapis unsynchronized;HashMapcan containnulls.So beware of these two when you swap in
HashMapforHashTable.