4 ms·
I think by "native" they mean "implemented-in-c++-by-the-JVM", which potentially vary; not java.util.HashTable, which should be pretty standard across JVM imple
by QuercusMax 9y ago
I think by "native" they mean "implemented-in-c++-by-the-JVM", which potentially vary; not java.util.HashTable, which should be pretty standard across JVM implementations.
- electrum 9y agoYes, although Hashtable is legacy from JDK 1.0. New code should use HashMap or ConcurrentHashMap.
- deleted 9y ago[deleted]
- Tharkun 9y agoPlease be careful with blanket statements like this. HashMap, Hashtable and ConcurrentHashMap behave differently in certain (subtle?) ways. ConcurrentHashMap doesn't like NULL but is thread-safe. Hashtable is synchronized, slow and thread-safe, but doesn't mind NULL. HashMap is not thread safe and doesn't mind NULL. Edit: pardon the dupes, on unreliable mobile link :-(
- josefx 9y ago> Hashtable is synchronized, slow and thread-safe, but doesn't mind NULL. The issue with Hashtable or rather all legacy collection classes is that the API is rarely useful without additional synchronization. So you might as well use a HashMap wrapped by Collections.synchronizedMap or use a ConcurrentHashMap with a placeholder object instead of null.