码迷,mamicode.com
首页 > 其他好文 > 详细

hash isEqual

时间:2017-06-19 16:25:04      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:protoc   http   for   add   either   sam   dev   ice   table   

hash

Returns an integer that can be used as a table address in a hash table structure.

 

If two objects are equal (as determined by the isEqual(_:) method), they must have the same hash value. This last point is particularly important if you define hash in a subclass and intend to put instances of that subclass into a collection. 

If a mutable object is added to a collection that uses hash values to determine the object’s position in the collection, the value returned by the hash method of the object must not change while the object is in the collection. Therefore, either the hash method must not rely on any of the object’s internal state information or you must make sure the object’s internal state information does not change while the object is in the collection. Thus, for example, a mutable dictionary can be put in a hash table but you must not change it while it is in there. (Note that it can be difficult to know whether or not a given object is in a collection.)

hash isEqual

标签:protoc   http   for   add   either   sam   dev   ice   table   

原文地址:http://www.cnblogs.com/feng9exe/p/7049176.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!