So I have this hash constructor:
What I want to know, is how can I change the loadFactor of the hash. All I know is that the default loadFactor is .75 but what if I wanted it to be something like .25. How would I be able to introduce the parameter float loadFactor into the constructor?class chainingHash<String>{ private static int DEFAULT_TABLE_SIZE = 101; private List<String>[] theList; static int currentSize; public chainingHash(int size){ theList = new LinkedList[nextPrime(size)]; for(int i = 0; i < theList.length; i++){ theList[i] = new LinkedList<>(); } } }
Here is my main method too:
public static void main(String[] arg){ chainingHash s = new chainingHash(10); for(int i = 0; i < 10; i++){ String word = words[(int)(Math.random()*nLine)]; s.insert(word); } s.print() };
The array words is just where I have a bunch of random words. Any help would be appreciated.