Differences in HashTable and HashMap (CC)

xiaoxiao2021-03-06  75

HashTable inherits from the Dictionary class, and HashMap is an implementation of the Map Interface introduced by Java 1.2; HashMap allows null as a key or value of Entry, while HashTable is not allowed; if there is HashMap to remove the HashTable's Contains method, Change to 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-93073.html

New Post(0)