I want to know why HashMap
always takes a size which is multiple of 2 and why other collections do not?
What is the reason behind that?
Thanks
I want to know why HashMap
always takes a size which is multiple of 2 and why other collections do not?
What is the reason behind that?
Thanks
In fact, all the time the load of your HashMap go more than 75%, a HashMap is created with a double size. This is the reason why hashmap size is always a power of two. You might be interested by this article : http://java.dzone.com/articles/hashmap-internal