We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent aa0a5a7 commit 86e136aCopy full SHA for 86e136a
src/main/java/org/json/JSONArray.java
@@ -1548,7 +1548,7 @@ private void addAll(Collection<?> collection) {
1548
private void addAll(Object array) throws JSONException {
1549
if (array.getClass().isArray()) {
1550
int length = Array.getLength(array);
1551
- this.myArrayList.ensureCapacity(length);
+ this.myArrayList.ensureCapacity(this.myArrayList.size() + length);
1552
for (int i = 0; i < length; i += 1) {
1553
this.put(JSONObject.wrap(Array.get(array, i)));
1554
}
0 commit comments