Question 13
Back to Exercise
What does counts.merge(word, 1, Integer::sum) do?
- A Always sets the count to 1
- B Inserts 1 if the word is absent, otherwise adds 1 to the existing count Correct
- C Merges two maps
- D Removes the word
Correct Answer: Option B
The idiomatic way to count.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!