Complete the code to declare a hash table using Java's HashMap.
HashMap<String, Integer> map = new [1]<>();HashMap is the correct class to create a hash table in Java.
Complete the code to insert a key-value pair into the hash table.
map.[1]("apple", 5);
The put method inserts or updates a key-value pair in a HashMap.
Fix the error in the hash function to compute index for a key.
int index = Math.abs(key.[1]()) % size;The hashCode() method returns an integer hash code for the key.
Fill both blanks to check if a key exists and then remove it from the hash table.
if (map.[1](key)) { map.[2](key); }
containsKey checks if the key exists, and remove deletes the key-value pair.
Fill all three blanks to create a hash function that uses the key's hash code and table size.
int hash = Math.abs([1].[2]()) [3] size;
The hash function uses the key's hashCode(), takes absolute value, and applies modulo (%) with the table size.
