Question: Map Problems For each of the Map problems, you ll be taking a Map as a parameter ( even if it doesn t show up

Map Problems
For each of the Map problems, youll be taking a Map as a parameter (even if it doesnt show up in the method signature).
contains3
Implement a method that returns true if any string occurs at least 3 times in the input list, and false otherwise. Use a map as auxiliary storage. For example, consider the following list:
["373","is", "fun", "HI", "fun", "fun"]
contains3 should return true given this input because fun shows up at least 3 times.
intersect
Implement a method that takes as input two maps from Strings to Integers and returns a new map whose contents are the intersection of the two. The intersection of two maps is defined here as the set of keys-value pairs that exist in both maps. If some key K maps to value V in both the first and second map, include it in your result. If K does not exist as a key in both maps, or if K does not map to the same value V in both maps, exclude that pair from your result.
For example, consider the following two maps:
map1: {Janet=87, Logan=62, Whitaker=46, Alyssa=100, Stefanie=80, Jeff=88, Kim=52, Sylvia=95}
map2: {Logan=62, Kim=52, Whitaker=52, Jeff=88, Stefanie=80, Brian=60, Lisa=83, Sylvia=87}
Calling intersect(map1, map2) would return the following new map (the order of the key-value pairs does not matter):
{Logan=62, Stefanie=80, Jeff=88, Kim=52}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!