Java allows us to specify the size and required load factor of the hash table we wish to create. If we use a custom HashCode method to generate keys on our own then the load factor must become dependent on the efficiency/goodness of our HashCode. How do I know that the load factor requirements i specified initially are still being met?
Below the load factor i want is 0.67.
Hashtable<Long, String[]> ht = new Hashtable<>(100, 0.67f);
However if I say the following
public int hashCode(int n){
int a = n%72;
return a;}
Then will the load factor of 0.67 still be preserved even though my hashcode function is quite poor?
As per your question, load factor of 0.67 still be preserved even if hashcode function is poor. Load factor is used to decide when to increase the size of the internal structure to accommodate new data set. In case of poor hashcode function, you may encounter many collisions.
Other experts can throw more light on this and help me to improve my answer.