Question: 1. Write statements to display all keyvalue pairs in Map object m, one pair per line. You will need to create an iterator to access

1. Write statements to display all keyvalue pairs in Map object m, one pair per line. You will need to create an iterator to access the map entries.
2. Assume that a Person has data fields lastName and firstName. Write an equals method that returns true if two Person objects have the same first and last names. Write a hashCode method that satisfies the hashCode contract. Make sure that your hashCode method does not return the same value for Henry James and James Henry. Your equals method should return a value of false for these two people.(equals method and hashCode method)
3. Assume class HashSetOpen is written using an array table for storage instead of a HashMap object. Write method contains.
4. Modify method showIndex so each output line displays a word followed by a comma and a list of line numbers separated by commas. You can either edit the string corresponding to each Map entry before displaying it or use methods Map.Entry.getKey and Map.Entry.getValue to build a different string.

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!