In the context of this exercise, how does the getter (retrieve) method work?
The getter, or
retrieve(), method works by utilizing the same
compressor() methods that were used for assigning a new key-value in the hash map.
When we are retrieving an entry, we essentially need to find where it was assigned in the first place. By using
compressor(), we can obtain this index. And, because hash maps always return the same hash code index for any key every time whether we’re adding or retrieving a key, this index should contain our target entry.
Later in the lesson, these methods will apply open addressing to the getter and setter, but the result will be essentially the same.