← Back to index
class CountMap
extends Map <T, number>

Acts as a Map<T, number> internally and counts the number of times a key is added.

Examples
🔗

Example 1

.add() to increase its count by 1. .remove() to decrease its count by 1.

Type Parameters
Methods
🔗
add (key: T): void

Increases count of given key by 1.

🔗
hasValue (val: number): boolean

Checks if map has given value.

🔗
remove (key: T): void

Decreases count of given key by 1.

If count is 0, removes the key.