Less than 1 minute
Home > @hz-9/algorithm > Hashmap > get
Hashmap.get() method
Retrieves the value from the hash map based on the key.
根据键从哈希表中获取值。
Time complexity: O(1)
Space complexity: O(1)
Signature:
abstract get(key: K): V | undefined;Parameters
Parameter | Type | Description |
|---|---|---|
key | K | The key object. |
Returns:
V | undefined
The value object. Returns undefined if the key does not exist.