Question: / * * * Receive a string of multiple words. * Return a Map object where the key is a word and the value is
Receive a string of multiple words.
Return a Map object where the key is a word and the value is the count of occurrences of the word.
You will need to instantiate a map, use the split on words, and iterate through the resulting array.
Inside of the resulting for loop, you should insert a new key to the map every time you encounter a word that
is not already a key in the map, and add to the word's count value every time you encounter a word that already
exists in the map.
@param words A string of Words separated by spaces.
@return a Map keyvalue pairs of all the words mapped to their number of occurrences.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
