Hashmap
Source code: https://github.com/gofhilman/hashmap
This project creates a HashMap class manually in JavaScript, which is a data structure that maps keys to values. It uses a hashing function to determine the index for storing key-value pairs in an array of linked lists. The HashMap dynamically resizes itself when the load factor exceeds a certain threshold, ensuring efficient operations.
Features
- Set Key-Value Pairs: Add or update key-value pairs in the hashmap.
- Get Values: Retrieve the value associated with a given key.
- Check Key Existence: Verify if a key exists in the hashmap.
- Remove Key-Value Pairs: Delete a key-value pair from the hashmap.
- Dynamic Resizing: Automatically resizes the hashmap when the load factor exceeds 0.75.
- Retrieve All Keys, Values, or Entries: Get all keys, values, or key-value pairs as arrays.
- Clear the HashMap: Reset the hashmap to its initial state.
- Customizable Capacity: Starts with an initial capacity of 16 and grows dynamically.