Hashtable and havehmap

xiaoxiao2021-03-06  53

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.

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-115132.html

New Post(0)