objective-c - OC中的字典可以一个key对应多个value吗?key不同,value相同的意思是?
为情所困
为情所困 2017-05-02 09:23:15
0
4
788

1.字典中的一个key可以对应多个value吗?

为情所困
为情所困

reply all(4)
習慣沉默

Key cannot be repeated in a Dictionary, but Value can be repeated

黄舟

A key can only be paired with one value, and one value can be paired with n keys

仅有的幸福

Obviously the key can only correspond to one value. If the key corresponds to multiple values, when you get the key at a certain moment, the computer will not know which value you want. The principle of key-value is that the value is variable, but the key is only constant. Just like a house number, this house number indicates a certain house in this location. Value is the person living in the house. The house can change its owner, which means we assign different values ​​to value. The one value mentioned above can correspond to multiple keys is not easy to explain with this example. It can be simply understood that two keys can be equal to the same value.

世界只因有你

If the key is a person, the value can be the person's name. A person may have multiple names, but there is no second identical person in the world (key uniqueness). There are many people with the same name and surname, but People who are all different from each other (the keys are different, the values ​​can be the same, one name corresponds to n people). The individual ID is key: the name is value. This is a dictionary (key-value pair).

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template