I was tyring to test if my array is empty, but I always get a null pointer exception for some reason. I don't understand since my test actually test if the value is null. Here is the code where it gets stucks. I get the null pointer on the While loop:
private int findIndex(String key) {
int index = calculateHashCode(key);
while (table[index] != null && !table[index].getKey().equals(key)) {
index = (index + 1) % TABLE_SIZE;
}
return index;
}
EDIT
table is declared like this:
static HashEntry[] table;
tabledeclared? It's likely thattableis null.