With everything in our setter taken care of, we want to make sure that when we retrieve our value we’re retrieving the correct value.
possible_return_value has a different
key than the one we’re looking for, we should continue searching.
Define a new variable called
retrieval_collisions and set it equal to
Insert a new
while loop that checks if
possible_return_value != key
In the while loop, we want to replicate our retrieval logic while increasing the count of
retrieval_collisions so that we continue to look at other locations within our array.
.hash() with both the
retrieval_collisions. Save that result into
.compressor(). Save that result into
retrieving_array_index and save the result as
possible_return_value. Check against the three possibilities:
- If it’s
- If it has a value, but a different key, increment
- If it’s key matches our