HashMap is a key-value data structure that uses hashing for fast access and implements the Map interface.
Key Characteristics:
- Stores key-value pairs with unique keys
- Uses hash function for O(1) average access time
- Handles collisions with separate chaining
- Allows null values and one null key
- Not synchronized (thread-unsafe)
Hash Calculation Example: For string "user" with map size 8:
Step 1: Calculate hashCode(): "user".hashCode() = 3599307
Step 2: Apply modulo: 3599307 % 8 = 3
Therefore, hash("user") = 3, so "user" is stored in bucket 3.