Java HashMap; Recommended?

It is reported that from Java JDK 1.3.1 to JDK 1.4.0 HashMap is 5 times slower (see here ).

What is the modern HashMap technology in java 6? Recommended to use?

Thanks.

+4
source share
3 answers

This bug has been flagged as fixed in 1.4.0_02 and 1.4.1, so there may be no need to worry about its performance in Java 1.6.

(If you are working in a multi-threaded environment, you probably need ConcurrrentHashMap.)

+11
source

Just for your information, if not already. The difference between a hash table and a hash table is that the hash table is synchronized and does not allow null as a key, the main difference is that hashmap has an improved hash function. thAt prevents getting two different objects in the same bucket or to prevent a Hash collision.

0
source

@Suresh It is not true that HashMap completely prevents collisions. In fact, each bucket contains an implementation of a singly linked list of records. Thus, collisions occur in the HashMap. I admit I'm not sure about the percentage of collisions compared to the Hashtable.

0
source

All Articles