NSCreateHashTableWithZone(_:_:_:)
Creates a new hash table in a given zone.
Declaration
func NSCreateHashTableWithZone(_ callBacks: NSHashTableCallBacks, _ capacity: Int, _ zone: NSZone?) -> NSHashTable<AnyObject>Return Value
A pointer to a new hash table created in the specified zone. If zone is NULL, the hash table is created in the default zone.
Discussion
The table’s size is dependent on (but generally not equal to) capacity. If capacity is 0, a small hash table is created. The NSHashTableCallBacks structure callBacks has five pointers to functions, with the following defaults: pointer hashing, if hash is NULL; pointer equality, if isEqual is NULL; no callback upon adding an element, if retain is NULL; no callback upon removing an element, if release is NULL; and a function returning a pointer’s hexadecimal value as a string, if describe is NULL. The hashing function must be defined such that if two data elements are equal, as defined by the comparison function, the values produced by hashing on these elements must also be equal. Also, data elements must remain invariant if the value of the hashing function depends on them; for example, if the hashing function operates directly on the characters of a string, that string can’t change.
See Also
Related Documentation
Functions
NSAllHashTableObjects(_:)NSCompareHashTables(_:_:)NSCopyHashTableWithZone(_:_:)NSCountHashTable(_:)NSCreateHashTable(_:_:)NSEndHashTableEnumeration(_:)NSEnumerateHashTable(_:)NSFreeHashTable(_:)NSHashGet(_:_:)NSHashInsert(_:_:)NSHashInsertIfAbsent(_:_:)NSHashInsertKnownAbsent(_:_:)NSHashRemove(_:_:)NSNextHashEnumeratorItem(_:)NSResetHashTable(_:)