If I want to create a Dictionary<Key:Value>()
it is required for the Key
type object to the protocol Hashable
. Why is that the case, how are Dictionaries implemented?
I mean I would understand that if the Key
just needs to conform to the protocol of Equatable
type, as the program will have to search for the related value, however, the extra var hashValue: Int
that comes along with Hashable
is a bit confusing