Your Custom Hash Table API

  1. HashPutResponseItem putAndMore(Key k, Value v): Check to see if key k is in the hash table. If so, replace its value by v. If not, insert this pair. Return a response item that describes what happened. (See the class definition for HashPutResponseItem.) The location field should be given as its value the index of the array or ArrayList where that key's separate chain can be found. The SeparateChain class doesn't know this, and so it returns -1 for location. Your code should put in the correct value.
  2. HashGetResponseItem getAndMore(Key key): Check to see if key k is in the hash table. If so, return the corresponding value v in the response item. If not, return null as the value in the response item. The response items should include the other information as described in the class definition for HashGetResponseItem.
  3. double getLambda(): Return the current load factor for the hash table.
  4. Set keySet(): Collect and return a set of all the keys that are currently in the hash table.
  5. int getTableSize(): Return the size of the current array (or ArrayList) being used to represent the hash table.
  6. void clear(): Remove all items from the hash table, so that it is empty, and any insertion that immediately follows will be guaranteed to not have a collision.
  7. int size(): Return the number of keys that are in the hash table.