Question: Add a main so that you can put some code there to call your functions and make sure they work: public static void main(String[] args)

Add a main so that you can put some code there to call your functions and make sure they work:

public static void main(String[] args) { /* your testing code goes here */ }

Functions you should add if the functionality is possible. Otherwise add an empty function definition with a comment saying "impossible".

Problem #4

public static HashMap buildLastNameToFirstNameMap(String[] fullNames) {

/* fullNames is an array of entries all in the format "FirstName LastName", a first name and a last name separated by a space. This function should return a map where the keys are the LastNames from the input array and the corresponding value is the associated FirstName. You may assume each LastName only occurs once in the input array. */

}

** Test input: an empty array; an array containing "Barry White" and "Bob Marley"

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!