Home > @silence_zhpf/utils > HashMap
该类在 TypeScript 中实现哈希映射数据结构。
Signature:
export declare class HashMap<T, U>
| Property | Modifiers | Type | Description |
|---|---|---|---|
| size | readonly |
number | 返回此HashMap的大小 |
| Method | Modifiers | Description |
|---|---|---|
| [Symbol.iterator]() | ||
| filter(fn) | 此函数根据给定条件过滤 HashMap 中的键值对,并返回过滤后的对的新 HashMap。 |
|
| filterKey(fn) | 此函数根据给定条件过滤 HashMap 的键,并返回过滤后的新HashMap。 |
|
| filterValue(fn) | 此函数根据给定条件过滤 HashMap 的值并返回过滤后的新的HashMap。 |
|
| get(key) | 此函数返回与HashMap中给定键关联的值,如果未找到该键,则返回undefined。 |
|
| has(key) | 此函数检查给定键是否存在于HashMap中并返回布尔值。 |
|
| insert(key, value) | 此函数将键值对插入 HashMap 并返回更新后的 HashMap |
|
| map(fn) | 这是一个 TypeScript 函数,它映射HashMap并根据提供的函数返回不同类型的新数组。 |
|
| mapKey(fn) | 此函数使用提供的函数将 HashMap 对象的键映射到新数组。 |
|
| mapValue(fn) | 此函数使用提供的函数将HashMap对象的值映射到新数组。 |
|
| new(array) | static |
此函数使用可选数组参数创建 HashMap 的新实例。 |
| remove(key) | 此函数从HashMap中删除给定键的内容对并返回与该键关联的值。 |