可选项关联对象的类型。
Returns an iterable of entries in the map.
Removes all elements from the Map.
对指定键的计数器加一,并可关联一个对象。
若键已存在,则将其计数加 1,并用传入的 object 覆盖已关联的对象;
若键不存在,则插入新记录,计数为 1。
需要计数的键。
可选object: T可选的关联对象,将覆盖该键之前关联的对象。
true if an element in the Map existed and has been removed, or false if the element does not exist.
Returns an iterable of key, value pairs for every entry in the map.
Returns a specified element from the Map object. If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the Map.
Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.
获取指定键关联的对象。
若键不存在或未关联对象,则返回 undefined。
需要查询的键。
该键关联的类型为 T 的对象,或 undefined。
boolean indicating whether an element with the specified key exists or not.
Returns an iterable of keys in the map
Adds a new element with a specified key and value to the Map. If an element with the same key already exists, the element will be updated.
Returns an iterable of values in the map
静态from从键数组或键-对象对数组创建新的 CountMap 实例。
传入数组时,每个元素既可以是仅含键的字符串,也可以是 [键, 对象] 元组。
初始化后所有键的计数均为 0,后续可通过 CountMap.count 累加。
可选项关联对象的类型。
键数组或键-对象对数组。
已初始化的新 CountMap<T> 实例。
静态group
用于统计字符串键出现次数的计数映射。
CountMap继承自Map,在键与计数器之间建立映射关系, 并可选择为每个键关联一个类型为T的对象。适用于频次统计、 标签计数、重复项检测等场景。添加于
26.4.13
参阅
CountMap.from
示例