I\'m getting this error in this line of code:
for (int i = Math.abs(key.hashCode()) % size; i < size; i++)
why is this happening?
The % operator returns the remainder after dividing the first number by the second number. If the second number (in your example size) is zero, then you will get a divide by zero ArithmeticException.
The key is to check if size is zero before performing this loop, and take the appropriate action.