Can multiple keys have the same value?


#1

Question

In the context of this exercise, can multiple keys of a hash map have the same value?

Answer

Yes, different hash map keys can indeed map to the same value. Values are not unique. However, the keys should be unique.

For instance, we may have the following table of emails (key) and the associated names (value).

'''
Key               Value
abe@email.com     Abraham
bob@email.com     Robert
rob@email.com     Robert
'''

Each person must have a unique key or email address, but they can share the same value or name.