Ask Question

Using the merge method of the Map interface, which statement correctly updates the salesTotalByDept map of type Map to update the sales total for a dept by an integer sales value? Question 3 options: salesTotalByDept. merge (dept, sales, (d, s) - > s + 1); sales. merge (salesTotalByDept, dept, (d, s) - > s + sales); dept. merge (salesTotalByDept, sales, (d, s) - > s + sales); salesTotalByDept. merge (dept, sales, (d, s) - > s + sales);

+2
Answers (1)
  1. 19 April, 13:50
    0
    salesTotalByDept. merge (dept, sales, (d, s) - > s + sales);

    Explanation:

    In the above statement merge () method is being used which updates the salesTotalByDept map of type Map to update the sales total for a dept by an integer sales value.

    Here dept and sales both are used and passed as a parameter to merge () method because salesTotalByDept can be update if both the information about sales and department are provided.

    Map. merge () method is used to place new value under the given key if the key does not correspond to any value, or is used to update existing key with a given value.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Using the merge method of the Map interface, which statement correctly updates the salesTotalByDept map of type Map to update the sales ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers