Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please provide only method Show Header OBJP5 Exercise 11.18: reverse Language/Type: Java Collections Sets and Maps Author: Jeff Prouty (on 2019/09/19) Write a method reverse
Please provide only method
Show Header OBJP5 Exercise 11.18: reverse Language/Type: Java Collections Sets and Maps Author: Jeff Prouty (on 2019/09/19) Write a method reverse that accepts a Map from integers to strings as a parameter and returns a new Map of strings to integers that is the original's "reverse". The reverse of a map is defined here to be a new map that uses the values from the original as its keys and the keys from the original as its values. Since a map's values need not be unique but its keys must be, it is acceptable to have any of the original keys as the value in the result. In other words, if the original map has pairs (k1, V) and (k2, v), the new map must contain either the pair (v, k1) or (v, k2). For example, for the following map {42=Marty, 81=Sue, 17=Ed, 31-Dave, 56=Ed, 3=Marty, 29=Ed} Your method could return the following new map (the order of the key/value pairs does not matter) {Marty=3, Sue=81, Ed=29, Dave=31} X Type your solution here: 1 cannot find symbol: method reverse(MapStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started