From the javadoc on accumulate
:
Accumulate values under a key. It is similar to the element method except that if there is already an object stored under the key then a JSONArray is stored under the key to hold all of the accumulated values. If there is already a JSONArray, then the new value is appended to it. In contrast, the replace method replaces the previous value.
From this, it seems that accumulateAll
would call accumulate
for all values in the map, i.e. values already in the object are not replaced, whereas putAll
might replace existing values.
Example:
You have an object like this: {"chars":"A"}
.
putAll
with a map containing"chars" -> "B"
would result in{"chars":"B"}
accumulateAll
with a map containing"chars" -> "B"
would result in{"chars":["A","B"]}