Added clear() methods to JSONObject and JSONArray

This commit is contained in:
Stranck 2020-12-04 00:49:21 +01:00
parent a57eff26d5
commit 57ad94ef5e
2 changed files with 16 additions and 0 deletions

View File

@ -567,6 +567,14 @@ public class JSONArray implements Iterable<Object> {
return this.myArrayList.size();
}
/**
* Removes all of the elements from this JSONArray.
* The JSONArray will be empty after this call returns.
*/
public void clear() {
return this.map.clear();
}
/**
* Get the optional object value associated with an index.
*

View File

@ -973,6 +973,14 @@ public class JSONObject {
return this.map.size();
}
/**
* Removes all of the elements from this JSONObject.
* The JSONObject will be empty after this call returns.
*/
public void clear() {
return this.map.clear();
}
/**
* Check if JSONObject is empty.
*