I need the internal implementation of HashTable in java code. Further can you explain me with Additional comments in code as how does it work.
I just have some basic knowledge on load factor and capacity used in HashTable where load factor is 0.75. Could you explain with a brief example.
I’m stuck up with this for a long time.
1> Why is load factor 0.75 for hashtable and not some other value which is varying. Quite strange Please clarify.
2> Why don’t we have load factor for HashMap ?
I don’t want the existing code. Some one who has written a better code than what is actually written
We do – see
HashMap(int initialCapacity, float loadFactor)The load factor for a
Hashtableis a tunable parameter.The javadoc for HashMaps says this about the
0.75value.I understand that the number was determined by empirical testing rather than by theoretical analysis. (A thorough theoretical analysis would be difficult. However, a load factor of 0.75 combined with a good hash function is probably sufficient to keep hash chains down to 1 or 2 in the vast majority of cases, and that results in fast average lookup times.)