I get a horrific stackoverflowerror, and figured it was my deep recursion causing it (well, the debugger helped with that...). Can anyone guide me in turning my recursion into a loop?
H<V>.Pair currPair = (H<V>.Pair) arr[startPos];
if (arr[startPos] == null) {
return null;
}
if (currPair.key.equals(key)) {
return currPair.value;
} else {
return find(gNL(startPos, ++stepNum, key), key, stepNum);
}
}
More specifically, return find(getNextLocation(startPos, ++stepNum, key), key, stepNum); causes the recursion.