NSHashTable
NSHashTable 类似 NSSet,但支持自定义指针语义(例如弱引用集合)。在插件中遇到它时,常用操作与集合类似。
类成员 (Class members)
Section titled “类成员 (Class members)”hashTableWithOptions
Section titled “hashTableWithOptions”按选项创建哈希表。
static hashTableWithOptions(options: number): NSHashTableParameters:
| Name | Type | Description |
|---|---|---|
options | number | 选项(如弱引用等)。 |
Return Value:
NSHashTable: 新实例。
weakObjectsHashTable
Section titled “weakObjectsHashTable”弱引用对象哈希表。
static weakObjectsHashTable(): NSHashTableReturn Value:
NSHashTable: 新实例。
实例成员 (Instance members)
Section titled “实例成员 (Instance members)”元素个数。
count(): numberReturn Value:
number: 个数。
member
Section titled “member”按相等性查找成员。
member(object: any): anyParameters:
| Name | Type | Description |
|---|---|---|
object | any | 待查找对象。 |
Return Value:
any: 集合中与之相等的对象或 undefined。
anyObject
Section titled “anyObject”任取一个元素。
anyObject(): anyReturn Value:
any: 任一元素或 undefined。
containsObject
Section titled “containsObject”是否包含某元素。
containsObject(anObject: any): booleanParameters:
| Name | Type | Description |
|---|---|---|
anObject | any | 待查找元素。 |
Return Value:
boolean: 是否包含。
allObjects
Section titled “allObjects”所有元素组成的数组。
allObjects(): NSArrayReturn Value:
NSArray: 元素数组。
setRepresentation
Section titled “setRepresentation”转为 NSSet 表示。
setRepresentation(): NSSetReturn Value:
NSSet: 集合表示。
pointerFunctions
Section titled “pointerFunctions”指针函数配置。
pointerFunctions(): anyReturn Value:
any: 指针函数对象。
objectEnumerator
Section titled “objectEnumerator”元素枚举器。
objectEnumerator(): NSEnumeratorReturn Value:
NSEnumerator: 枚举器。
addObject
Section titled “addObject”添加对象。
addObject(object: any): voidParameters:
| Name | Type | Description |
|---|---|---|
object | any | 要添加的对象。 |
Return Value:
- 无。
removeObject
Section titled “removeObject”移除对象。
removeObject(object: any): voidParameters:
| Name | Type | Description |
|---|---|---|
object | any | 要移除的对象。 |
Return Value:
- 无。
removeAllObjects
Section titled “removeAllObjects”清空哈希表。
removeAllObjects(): voidReturn Value:
- 无。
intersectsHashTable
Section titled “intersectsHashTable”是否与另一哈希表有交集。
intersectsHashTable(other: NSHashTable): booleanParameters:
| Name | Type | Description |
|---|---|---|
other | NSHashTable | 另一哈希表。 |
Return Value:
boolean: 是否有交集。
isEqualToHashTable
Section titled “isEqualToHashTable”是否与另一哈希表相等。
isEqualToHashTable(other: NSHashTable): booleanParameters:
| Name | Type | Description |
|---|---|---|
other | NSHashTable | 另一哈希表。 |
Return Value:
boolean: 是否相等。
isSubsetOfHashTable
Section titled “isSubsetOfHashTable”是否为另一哈希表的子集。
isSubsetOfHashTable(other: NSHashTable): booleanParameters:
| Name | Type | Description |
|---|---|---|
other | NSHashTable | 另一哈希表。 |
Return Value:
boolean: 是否为子集。
intersectHashTable
Section titled “intersectHashTable”与另一哈希表取交集(结果写回自身)。
intersectHashTable(other: NSHashTable): voidParameters:
| Name | Type | Description |
|---|---|---|
other | NSHashTable | 另一哈希表。 |
Return Value:
- 无。
unionHashTable
Section titled “unionHashTable”与另一哈希表取并集(结果写回自身)。
unionHashTable(other: NSHashTable): voidParameters:
| Name | Type | Description |
|---|---|---|
other | NSHashTable | 另一哈希表。 |
Return Value:
- 无。
minusHashTable
Section titled “minusHashTable”与另一哈希表取差集(结果写回自身)。
minusHashTable(other: NSHashTable): voidParameters:
| Name | Type | Description |
|---|---|---|
other | NSHashTable | 另一哈希表。 |
Return Value:
- 无。