Question: JAVA: The goal of this assignment is to implement your own simplified version of the Java HashMap class using hashed keys. Your class should be

JAVA:

The goal of this assignment is to implement your own simplified version of the Java HashMap class using hashed keys. Your class should be able to accept key/value pairs and store the value data in such a manner that it can be retrieved by its key. Assume the value to be stored in the Map is of type Object.

The insert method should return false if there is already an entry with that key

The get method should return nullptr (or NULL) if there is no element with the specified key

The remove method should return false if there is no element with the specified key

How you store the hashed keys and their associated values is up to you. However, you should consider how you can best organize the keys and data so that searching for a hashed key is as fast and efficient as possible. Once you locate the hash of the supplied key, it should lead you directly to its associated data.Your class is to actually use a hash of the key string to identify the value. This will make it simpler to search for the associated value and generally maintain the map. You could write your own hash function, but youre generally better off using one thats commonly available.

Assume there is no maximum on the number of key/value pairs that can be stored in the map. Your program should add at least 100 to show that it is working correctly. After adding them, it should call the get, remove, and size methods, printing enough information on the console to show that they work. Include error conditions such as trying to create duplicate keys and calls to get data from non-existent keys to show they work correctly also.

Implement YOUR OWN simplified version of the Java HashMap. (Do not import java.HashMap) Use either ArrayList or LinkedList. Must show at least 4 methods working correctly for every Map instance.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!