Hi! It has been reported that from Java JDK 1.3.1 to JDK 1.4.0 HashMap is 5 times slower (see here).
What is the state of the art of HashMap at java 6? Is recommendable to be used?
Thanks, Luis
Hi! It has been reported that from Java JDK 1.3.1 to JDK 1.4.0 HashMap is 5 times slower (see here).
What is the state of the art of HashMap at java 6? Is recommendable to be used?
Thanks, Luis
That bug is marked fixed in 1.4.0_02 and 1.4.1, so there probably isn't any need to worry about its performance in Java 1.6.
(If you're in a multithreaded environment, you probably want ConcurrrentHashMap.)
Just for your information , if do not already.the difference between the hashmap and the hashtable is that hashtable is synchronized and does not allow null as key also the main difference is that hashmap has enhanced hash function thAt prevents two different object getting in to single bucket or to prevent Hash collision.
@Suresh It is not correct to say that HashMap prevents collisions altogether. In fact, in each bucket, there lies an implementation of a singly linked-list of entries. So, collisions do happen in HashMap. I admit I'm not sure about the percentage of collisions as compared to Hashtable.