Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java HashMap; Is recommendable?

Tags:

java

hashmap

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.

like image 235
Luixv Avatar asked Dec 22 '22 22:12

Luixv


1 Answers

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.)

like image 99
Matthew Wilson Avatar answered Jan 14 '23 16:01

Matthew Wilson