mirror of
https://github.com/ethauvin/JSON-java.git
synced 2025-06-17 07:50:52 -07:00
Increase array list capacity in addAll method to ensure it can hold additional elements.
This commit is contained in:
parent
aa0a5a7245
commit
86e136afc9
1 changed files with 1 additions and 1 deletions
|
@ -1548,7 +1548,7 @@ public class JSONArray implements Iterable<Object> {
|
|||
private void addAll(Object array) throws JSONException {
|
||||
if (array.getClass().isArray()) {
|
||||
int length = Array.getLength(array);
|
||||
this.myArrayList.ensureCapacity(length);
|
||||
this.myArrayList.ensureCapacity(this.myArrayList.size() + length);
|
||||
for (int i = 0; i < length; i += 1) {
|
||||
this.put(JSONObject.wrap(Array.get(array, i)));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue