diff options
Diffstat (limited to 'json/src/main')
-rw-r--r-- | json/src/main/java/org/json/JSONArray.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/json/src/main/java/org/json/JSONArray.java b/json/src/main/java/org/json/JSONArray.java index a885125..8b7d0af 100644 --- a/json/src/main/java/org/json/JSONArray.java +++ b/json/src/main/java/org/json/JSONArray.java @@ -276,6 +276,17 @@ public class JSONArray { } /** + * Removes and returns the value at {@code index}, or null if the array has no value + * at {@code index}. + */ + public Object remove(int index) { + if (index < 0 || index >= values.size()) { + return null; + } + return values.remove(index); + } + + /** * Returns the value at {@code index} if it exists and is a boolean or can * be coerced to a boolean. * |