Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedPlease 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(Map) This is a method problem. Write a Java method as described. Do not write a complete program or class; just the method(s) above. Submit 4. Indent O Sound FIX Highlighting Your code did not compile. Please read and correct the errors below. Error emitted from internal testing code. This error is occurring when our internal testing code is trying to call your code. If you see this, it may mean that you have the wrong header for your solution, or a mismatched { } ( brace. You are referring to a name that is not recognized. Perhaps you misspelled it, mis-capitalized it, or forgot to declare it? cannot find symbol: method reverse (Map) Map reversed = reverse(map)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David M. Kroenke, David Auer

11th Edition

B003Y7CIBU, 978-0132302678

More Books

Students also viewed these Databases questions

Question

5) The error in wavelength measurement AL =O.05m where A=2 AL

Answered: 1 week ago

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago