Thursday, May 26, 2011

Warm up question: What is the difference between Hashtable and Hashmap?

Notes on Hashtable and Hashmap.
      Both provide key-value access to data.
  • HashMap permits null value while Hashtable does not.
  • Access to Hashtable is synchronized on the table while access to the HashMap is not (by default).
  • Iterator in the HashMap is fail-safe while the enumerator for the Hashtable is not.
  • Hashtable is an original collection class in Java while HashMap is part of the new collections framework.



No comments:

Post a Comment