Hashtable and havehmap

zhaozj2021-02-16  62

HashTable inherits from the Dictionary class, and Hashmap is a implementation of the Map Interface introduced by Java1.2. HashMap allows null as a key or value of the entry, and HashTable is not allowed, and HashMap puts the HashTable's contAins method, changed ContainsValue and Containskey. Because the Contains method is easy to cause misunderstandings. The biggest difference is that the HashTable method is Synchronize, and HashMap is not, when accessed HashTable, does not need to be synchronized for its method, and HashMap must provide external synchronization. Hash / rehash algorithms used by HashTable and Hashmap are probably, so performance will not have a big difference.

转载请注明原文地址:https://www.9cbs.com/read-15382.html

New Post(0)