Write the output produced when the following method is passed each of the following maps: a. {sheep=wool,

Question:

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

public static void mystery (Map m) { Set s new TreeSet () ; for (String key : m.keySet ()) { if (!m.get (key) .equals (key)) { s.add (m.get (key)); } else { s.remove (m.get (key)); System.out.println (s);

a. {sheep=wool, house=brick, cast=plaster, wool=wool}

b. {ball=blue, winkie=yellow, corn=yellow, grass=green, emerald=green}

c. {pumpkin=peach, corn=apple, apple=apple, pie=fruit, peach=peach}

d. {lab=ipl, lion=cat, corgi=dog, cat=cat, emu=animal, nyan=cat}

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: