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...


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}



Jun 03, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here