Write the map returned when the following method is passed the following maps: a. map1: {bar=1, baz=2,

Question:

Write the map returned when the following method is passed the following maps:

public Map mystery (Map mapl, Map map2) { Map result = new TreeMap (); for (String sl : mapl.keySet ()) { if (map2.containsKey (mapl.get (sl))) { result.put (s1, map2.get (mapl.get (sl))) ; return result; }


a. map1: {bar=1, baz=2, foo=3, mumble=4}, map2: {1=earth, 2=wind, 3=air, 4=fire}

b. map1: {five=105, four=104, one=101, six=106, three=103, two=102}, map2: {99=uno, 101=dos, 103=tres, 105=quatro}

c. map1: {a=42, b=9, c=7, d=15, e=11, f=24, g=7}, map2: {1=four, 3=score, 5=and, 7=seven, 9=years, 11=ago}

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

Step by Step Answer:

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