While the HashMap class is not thread-safe and permits one null key, the Hashtable class is thread-safe and permits non-null keys and values only. The thread-safety the Hashtable class provides has a performance penalty. Thread-safe use of maps is also provided by the methods in the Collections class. Like the Vector class, the Hashtable class is also a legacy class that has been retrofitted to implement the Map interface.
No comments:
Post a Comment