Chaining Hashmap Practice Quiz
Practice Problem
Take out a piece of paper and put your name on the upper right corner.
Write the V put(K key, V value) method for the following Hashmap. The Hashmap uses Chaining.
public class HashmapChaining<K, V> {
private LinkedList<Entry<K, V>>[] table;
/**
* Associates the value with the given key.
* @param key, the key.
* @param value, the value.
* @return The previous value associated with the given key.
*/
public V put(K key, V value) {
// your code.
}
private class Entry<K,V> {
K key;
V value;
}
}
Time Remaining:
You can restart the timer by reloading the page.
Try to complete the problem in 15 minutes.
If you cannot complete the program in 15 minutes, you can watch me solve the problem in a text editor.