how do I instantiate a map, using 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.
Map<String, Integer> map = new Hash Map<String, Integer>();
for (String s : string Array) {
if (containerization(s)) {
map.put(s, map.get(s) + 1);
} else {
map.put(s, 1);
}
}
return map;
}
}
The code you may want to write accoringly to the description:
Note that it can be improved this way:
Or that way: