Question: Write the output produced when the following method is passed each of the following maps: a. {two=deux, five=cinq, one=un, three=trois, four=quatre} b. {skate=board, drive=car, program=computer,

Write the output produced when the following method is passed each of the following maps:

public static void mystery (Map map) { Map result new TreeMap (); for (String key : map.keySet ()) { if (key.compareTo (map.get (key)) < 0) { result.put (key, map.get (key)) ; } else { result.put (map.get (key), key); } System.out.println (result);

a. {two=deux, five=cinq, one=un, three=trois, four=quatre}

b. {skate=board, drive=car, program=computer, play=computer}

c. {siskel=ebert, girl=boy, H=T, ready=begin, first=last, begin=end}

d. {cotton=shirt, tree=violin, seed=tree, light=tree, rain=cotton}

public static void mystery (Map map) { Map result new TreeMap (); for (String key : map.keySet ()) { if (key.compareTo (map.get (key)) < 0) { result.put (key, map.get (key)) ; } else { result.put (map.get (key), key); } System.out.println (result);

Step by Step Solution

3.51 Rating (158 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Output produced when the mystery method is pass... View full answer

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 Building Java Programs A Back to Basics Approach Questions!