public class JsonArray extends ArrayList<Object>
ArrayList with helper methods to determine the underlying JSON type of the list element.modCount| Constructor and Description |
|---|
JsonArray()
Creates an empty
JsonArray with the default capacity. |
JsonArray(Collection<? extends Object> collection)
Creates an empty
JsonArray from the given collection of objects. |
JsonArray(int initialCapacity)
Creates an empty
JsonArray with the default initial capacity. |
| Modifier and Type | Method and Description |
|---|---|
static JsonBuilder<JsonArray> |
builder()
Creates a
JsonBuilder for a JsonArray. |
static JsonArray |
from(Object... contents)
Creates a
JsonArray from an array of contents. |
Object |
get(int key)
Returns the underlying object at the given index, or null if it does not exist.
|
JsonArray |
getArray(int key)
Returns the
JsonArray at the given index, or null if it does not exist or is the wrong type. |
JsonArray |
getArray(int key,
JsonArray default_)
Returns the
JsonArray at the given index, or the default if it does not exist or is the wrong type. |
boolean |
getBoolean(int key)
Returns the
Boolean at the given index, or false if it does not exist or is the wrong type. |
boolean |
getBoolean(int key,
Boolean default_)
Returns the
Boolean at the given index, or the default if it does not exist or is the wrong type. |
double |
getDouble(int key)
Returns the
Double at the given index, or 0.0 if it does not exist or is the wrong type. |
double |
getDouble(int key,
double default_)
Returns the
Double at the given index, or the default if it does not exist or is the wrong type. |
float |
getFloat(int key)
Returns the
Float at the given index, or 0.0f if it does not exist or is the wrong type. |
float |
getFloat(int key,
float default_)
Returns the
Float at the given index, or the default if it does not exist or is the wrong type. |
int |
getInt(int key)
Returns the
Integer at the given index, or 0 if it does not exist or is the wrong type. |
int |
getInt(int key,
int default_)
Returns the
Integer at the given index, or the default if it does not exist or is the wrong type. |
long |
getLong(int key)
Returns the
Long at the given index, or 0 if it does not exist or is the wrong type. |
long |
getLong(int key,
long default_)
Returns the
Long at the given index, or the default if it does not exist or is the wrong type. |
Number |
getNumber(int key)
Returns the
Number at the given index, or null if it does not exist or is the wrong type. |
Number |
getNumber(int key,
Number default_)
Returns the
Number at the given index, or the default if it does not exist or is the wrong type. |
JsonObject |
getObject(int key)
Returns the
JsonObject at the given index, or null if it does not exist or is the wrong type. |
JsonObject |
getObject(int key,
JsonObject default_)
Returns the
JsonObject at the given index, or the default if it does not exist or is the wrong type. |
String |
getString(int key)
Returns the
String at the given index, or null if it does not exist or is the wrong type. |
String |
getString(int key,
String default_)
Returns the
String at the given index, or the default if it does not exist or is the wrong type. |
boolean |
has(int key)
Returns true if the array has an element at that index (even if that element is null).
|
boolean |
isBoolean(int key)
Returns true if the array has a boolean element at that index.
|
boolean |
isNull(int key)
Returns true if the array has a null element at that index.
|
boolean |
isNumber(int key)
Returns true if the array has a number element at that index.
|
boolean |
isString(int key)
Returns true if the array has a string element at that index.
|
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, forEach, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeequals, hashCodecontainsAll, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitcontainsAll, equals, hashCodeparallelStream, streampublic JsonArray()
JsonArray with the default capacity.public JsonArray(int initialCapacity)
JsonArray with the default initial capacity.public JsonArray(Collection<? extends Object> collection)
JsonArray from the given collection of objects.public static JsonArray from(Object... contents)
JsonArray from an array of contents.public static JsonBuilder<JsonArray> builder()
JsonBuilder for a JsonArray.public Object get(int key)
public JsonArray getArray(int key)
JsonArray at the given index, or null if it does not exist or is the wrong type.public JsonArray getArray(int key, JsonArray default_)
JsonArray at the given index, or the default if it does not exist or is the wrong type.public boolean getBoolean(int key)
Boolean at the given index, or false if it does not exist or is the wrong type.public boolean getBoolean(int key,
Boolean default_)
Boolean at the given index, or the default if it does not exist or is the wrong type.public double getDouble(int key)
Double at the given index, or 0.0 if it does not exist or is the wrong type.public double getDouble(int key,
double default_)
Double at the given index, or the default if it does not exist or is the wrong type.public float getFloat(int key)
Float at the given index, or 0.0f if it does not exist or is the wrong type.public float getFloat(int key,
float default_)
Float at the given index, or the default if it does not exist or is the wrong type.public int getInt(int key)
Integer at the given index, or 0 if it does not exist or is the wrong type.public int getInt(int key,
int default_)
Integer at the given index, or the default if it does not exist or is the wrong type.public long getLong(int key)
Long at the given index, or 0 if it does not exist or is the wrong type.public long getLong(int key,
long default_)
Long at the given index, or the default if it does not exist or is the wrong type.public Number getNumber(int key)
Number at the given index, or null if it does not exist or is the wrong type.public Number getNumber(int key, Number default_)
Number at the given index, or the default if it does not exist or is the wrong type.public JsonObject getObject(int key)
JsonObject at the given index, or null if it does not exist or is the wrong type.public JsonObject getObject(int key, JsonObject default_)
JsonObject at the given index, or the default if it does not exist or is the wrong type.public String getString(int key)
String at the given index, or null if it does not exist or is the wrong type.public String getString(int key, String default_)
String at the given index, or the default if it does not exist or is the wrong type.public boolean has(int key)
public boolean isBoolean(int key)
public boolean isNull(int key)
public boolean isNumber(int key)
public boolean isString(int key)
Copyright © 2020. All rights reserved.