Is it necessary to use MapState.put() to manually update the state or whether is the state automatically updated when I modify an object?
private transient MapState<String, Word> words;
.......
Word w = words.get(word);
if (w == null) {
w = new Word(word);
//words.put(word, w); //A
}
if (....) {
w.countBad(1); // countXXX modifies a the private variable in a Word object
} else {
w.countGood(1);
}
//words.put(word, w); //B
Q: If I use the A method, will the next count calculation automatically update the corresponding Mapstate state? Or do I need to use the B method to manually update the state after the calculation is complete?