Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

14. What happens if you put () an item into amap that has a key that matches an

ID: 3610800 • Letter: 1

Question

14. What happens if you put () an item into amap that has a key that matches an item already in themap?______________________________________________________________ 15. The Map get method returns what kind of ananimal?____________________ 16.Each Map entry has a _______ that maps to asingle________. 17. _______T/F   Set has an iterator() method. 18. _______T/F   Map has an iterator()method. 14. What happens if you put () an item into amap that has a key that matches an item already in themap?______________________________________________________________ 15. The Map get method returns what kind of ananimal?____________________ 16.Each Map entry has a _______ that maps to asingle________. 17. _______T/F   Set has an iterator() method. 18. _______T/F   Map has an iterator()method.

Explanation / Answer

Dear... 14)   Associates the specified value with the specified key in thismap (optional operation). If the map previously contained a mappingfor this key, the old value is replaced by the specifiedvalue. Associates the specified value with the specified key in thismap (optional operation). If the map previously contained a mappingfor this key, the old value is replaced by the specifiedvalue.
15)     We use the get() , to get the appropriate data from the mapinterface.          public classAnimal                {
              privateMap<String,Animal> friends = newHashMap<String,Animal>();
              public void addFriend(String name, Animalanimal)                    {
              friends.put(name,animal);
                }
                 public Animal callFriend(Stringname)                   {
             returnfriends.get(name);
              }
            } 3)
      No. 4)       
          Maps do notprovide an iterator() method as do Lists and Sets. and A Setof either keys (keySet()) or key-value Map.Entry elements(entrySet()) can be obtained from the Map, and one can iterate overthat. I hope it is useful toyou.
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote