Question: Java Programming NewTable Class methods.Could use some help with this one. Need to fill out methods listed below the main snippet. Thank you. import java.util.Iterator;
Java Programming NewTable Class methods.Could use some help with this one. Need to fill out methods listed below the main snippet. Thank you.
import java.util.Iterator; import java.util.LinkedList; import java.util.ListIterator; import java.util.Vector;
class HashPair
public class NewTable{ private Vector< LinkedList< HashPair
/** Implement methods these methods**/
//Constructor public NewTable(int capacity)
//The put method //precondition neither key nor element may be null. public E put(K key, E element)
//The containsKey method //precondition key cannot be null. true if this table contains an object with the specified key, false otherwise. public boolean containsKey(K key)
//The get method //precondition cannot be null. returns a reference to the object with the specified key. null otherwise. //key.equals() is used to compare the key to the keys that are in the table. public E get(K key)
//The remove method //precondition cannot be null //key.equals() is used to compare the key to the keys that are in the table. public E remove(K key)
//The clear method - Removes all entries in the hash table public void clear()
//The hash method - Returns the hash value of key public int hash(K key)
//The size method Returns the number of elements currently in the hash table public int size()
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
