Question: Create a package named, prob1 and a class named, Combine. Write a method named combine that accepts a two ArrayLists, list1 and list2 of the

Create a package named, "prob1" and a class named, "Combine". Write a method named combine that accepts a two ArrayLists, list1 and list2 of the same length, as arguments. Each List stores integers. The method should return a map where the keys are the elements in list1 and the values are the elements in list2 in reverse order. Thus, the key for the first entry inserted in the map is the first element in list1 and the corresponding value is the last element in list2. The key for the second entry inserted in the map is the second element in list1 and the corresponding value is the next to last element in list 2, etc. You can assume the two lists have the same number of elements. Write a main method using the following test code to create two lists, then call the method combine, and use for-each loop to print out all the entries in the resulting Map. ArrayList
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
