summaryrefslogtreecommitdiffstats
path: root/json/src/main/java/org
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-07-10 00:12:06 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2013-07-10 00:12:06 +0000
commite94a2d12b6f3c4592f4ccc44f78db5c2c6cb6eb7 (patch)
tree5e566bb2b3c593aff6022856c5b4615ba81383a8 /json/src/main/java/org
parent131dcd13038e931d75cd3a63d14df0527670f7f3 (diff)
parent609601075ec0934cb23783c0b1194ecde041b6f5 (diff)
downloadlibcore-e94a2d12b6f3c4592f4ccc44f78db5c2c6cb6eb7.zip
libcore-e94a2d12b6f3c4592f4ccc44f78db5c2c6cb6eb7.tar.gz
libcore-e94a2d12b6f3c4592f4ccc44f78db5c2c6cb6eb7.tar.bz2
Merge "Implement JSONArray.remove."
Diffstat (limited to 'json/src/main/java/org')
-rw-r--r--json/src/main/java/org/json/JSONArray.java11
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.
*