public interface JSONArray extends java.lang.Iterable<java.lang.Object>, JSONComponent
| Modifier and Type | Method and Description |
|---|---|
<A extends JSONArray,O extends JSONObject> |
clone(JSONBuilder<A,O> builder) |
boolean |
equalsList(java.util.List<java.lang.Object> list) |
java.lang.Object |
get(int index)
Get the object value associated with an index.
|
boolean |
getBoolean(int index)
Get the boolean value associated with an index.
|
double |
getDouble(int index)
Get the double value associated with an index.
|
int |
getInt(int index)
Get the int value associated with an index.
|
JSONArray |
getJSONArray(int index)
Get the JSONArray associated with an index.
|
JSONObject |
getJSONObject(int index)
Get the JSONObject associated with an index.
|
long |
getLong(int index)
Get the long value associated with an index.
|
java.lang.String |
getString(int index)
Get the string associated with an index.
|
int |
indexOf(java.lang.Object value) |
boolean |
isNull(int index)
Determine if the value is null.
|
java.util.Iterator<java.lang.Object> |
iterator() |
int |
length()
Get the number of elements in the JSONArray, included nulls.
|
java.lang.Object |
opt(int index)
Get the optional object value associated with an index.
|
boolean |
optBoolean(int index)
Get the optional boolean value associated with an index.
|
boolean |
optBoolean(int index,
boolean defaultValue)
Get the optional boolean value associated with an index.
|
double |
optDouble(int index)
Get the optional double value associated with an index.
|
double |
optDouble(int index,
double defaultValue)
Get the optional double value associated with an index.
|
int |
optInt(int index)
Get the optional int value associated with an index.
|
int |
optInt(int index,
int defaultValue)
Get the optional int value associated with an index.
|
JSONArray |
optJSONArray(int index)
Get the optional JSONArray associated with an index.
|
JSONObject |
optJSONObject(int index)
Get the optional JSONObject associated with an index.
|
long |
optLong(int index)
Get the optional long value associated with an index.
|
long |
optLong(int index,
long defaultValue)
Get the optional long value associated with an index.
|
java.lang.String |
optString(int index)
Get the optional string value associated with an index.
|
java.lang.String |
optString(int index,
java.lang.String defaultValue)
Get the optional string associated with an index.
|
JSONArray |
put(boolean value)
Append a boolean value.
|
JSONArray |
put(double value)
Append a double value.
|
JSONArray |
put(int value)
Append an int value.
|
JSONArray |
put(int index,
boolean value)
Put or replace a boolean value in the JSONArray.
|
JSONArray |
put(int index,
double value)
Put or replace a double value.
|
JSONArray |
put(int index,
int value)
Put or replace an int value.
|
JSONArray |
put(int index,
long value)
Put or replace a long value.
|
JSONArray |
put(int index,
java.lang.Object value)
Put or replace an object value in the JSONArray.
|
JSONArray |
put(long value)
Append an long value.
|
JSONArray |
put(java.lang.Object value)
Append an object value.
|
java.lang.Object |
remove(int index)
Remove an index and close the hole.
|
boolean |
remove(java.lang.Object obj)
Remove the first instance of an Object from the array.
|
toString, toString, toString, writejava.util.Iterator<java.lang.Object> iterator()
iterator in interface java.lang.Iterable<java.lang.Object>boolean equalsList(java.util.List<java.lang.Object> list)
<A extends JSONArray,O extends JSONObject> A clone(JSONBuilder<A,O> builder) throws JSONException
JSONExceptionjava.lang.Object get(int index)
index - The index must be between 0 and length() - 1.boolean getBoolean(int index)
throws JSONException
index - The index must be between 0 and length() - 1.JSONException - If there is no value for the index or if the value is not convertible to boolean.double getDouble(int index)
throws JSONException
index - The index must be between 0 and length() - 1.JSONException - If the key is not found or if the value cannot be converted to a number.int getInt(int index)
throws JSONException
index - The index must be between 0 and length() - 1.JSONException - If the key is not found or if the value is not a number.JSONArray getJSONArray(int index) throws JSONException
index - The index must be between 0 and length() - 1.JSONException - If there is no value for the index. or if the value is not a JSONArrayJSONObject getJSONObject(int index) throws JSONException
index - subscriptJSONException - If there is no value for the index or if the value is not a JSONObjectlong getLong(int index)
throws JSONException
index - The index must be between 0 and length() - 1.JSONException - If the key is not found or if the value cannot be converted to a number.java.lang.String getString(int index)
throws JSONException
index - The index must be between 0 and length() - 1.JSONException - If there is no value for the index.boolean isNull(int index)
index - The index must be between 0 and length() - 1.int length()
java.lang.Object opt(int index)
index - The index must be between 0 and length() - 1.boolean optBoolean(int index)
index - The index must be between 0 and length() - 1.boolean optBoolean(int index,
boolean defaultValue)
index - The index must be between 0 and length() - 1.defaultValue - A boolean default.double optDouble(int index)
index - The index must be between 0 and length() - 1.double optDouble(int index,
double defaultValue)
index - subscriptdefaultValue - The default value.int optInt(int index)
index - The index must be between 0 and length() - 1.int optInt(int index,
int defaultValue)
index - The index must be between 0 and length() - 1.defaultValue - The default value.JSONArray optJSONArray(int index)
index - subscriptJSONObject optJSONObject(int index)
index - The index must be between 0 and length() - 1.long optLong(int index)
index - The index must be between 0 and length() - 1.long optLong(int index,
long defaultValue)
index - The index must be between 0 and length() - 1.defaultValue - The default value.java.lang.String optString(int index)
index - The index must be between 0 and length() - 1.java.lang.String optString(int index,
java.lang.String defaultValue)
index - The index must be between 0 and length() - 1.defaultValue - The default value.JSONArray put(boolean value)
value - A boolean value.JSONArray put(double value) throws JSONException
value - A double value.JSONException - if the value is not finite.JSONArray put(int value)
value - An int value.JSONArray put(long value)
value - A long value.JSONArray put(java.lang.Object value)
value - An object value. The value should be a Boolean, Double, Integer, JSONArray,
JSONObject, Long, or String, or the JSONObject.NULL object.JSONArray put(int index, boolean value) throws JSONException
index - The subscript.value - A boolean value.JSONException - If the index is negative.JSONArray put(int index, double value) throws JSONException
index - The subscript.value - A double value.JSONException - If the index is negative or if the value is not finite.JSONArray put(int index, int value) throws JSONException
index - The subscript.value - An int value.JSONException - If the index is negative.JSONArray put(int index, long value) throws JSONException
index - The subscript.value - A long value.JSONException - If the index is negative.JSONArray put(int index, java.lang.Object value) throws JSONException
index - The subscript.value - The value to put into the array. The value should be a Boolean, Double, Integer,
JSONArray, JSONObject, Long, or String, or the JSONObject.NULL object.JSONException - If the index is negative or if the the value is an invalid number.java.lang.Object remove(int index)
index - The index of the element to be removed.boolean remove(java.lang.Object obj)
obj - The object to be removed from the array.int indexOf(java.lang.Object value)