- All Implemented Interfaces:
Serializable,Cloneable,Iterable<Object>,Collection<Object>,List<Object>,RandomAccess,SequencedCollection<Object>
Extends an
ArrayList with helper methods to determine the underlying JSON type of the list element.- See Also:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic JsonBuilder<JsonArray> builder()Creates aJsonBuilderfor aJsonArray.static JsonArrayCreates aJsonArrayfrom an array of contents.get(int key) Returns the underlying object at the given index, or null if it does not exist.getArray(int key) Returns theJsonArrayat the given index, or null if it does not exist or is the wrong type.Returns theJsonArrayat the given index, or the default if it does not exist or is the wrong type.booleangetBoolean(int key) Returns theBooleanat the given index, or false if it does not exist or is the wrong type.booleangetBoolean(int key, Boolean default_) Returns theBooleanat the given index, or the default if it does not exist or is the wrong type.doublegetDouble(int key) Returns theDoubleat the given index, or 0.0 if it does not exist or is the wrong type.doublegetDouble(int key, double default_) Returns theDoubleat the given index, or the default if it does not exist or is the wrong type.floatgetFloat(int key) Returns theFloatat the given index, or 0.0f if it does not exist or is the wrong type.floatgetFloat(int key, float default_) Returns theFloatat the given index, or the default if it does not exist or is the wrong type.intgetInt(int key) Returns theIntegerat the given index, or 0 if it does not exist or is the wrong type.intgetInt(int key, int default_) Returns theIntegerat the given index, or the default if it does not exist or is the wrong type.longgetLong(int key) Returns theLongat the given index, or 0 if it does not exist or is the wrong type.longgetLong(int key, long default_) Returns theLongat the given index, or the default if it does not exist or is the wrong type.getNumber(int key) Returns theNumberat the given index, or null if it does not exist or is the wrong type.Returns theNumberat the given index, or the default if it does not exist or is the wrong type.getObject(int key) Returns theJsonObjectat the given index, or null if it does not exist or is the wrong type.getObject(int key, JsonObject default_) Returns theJsonObjectat the given index, or the default if it does not exist or is the wrong type.getString(int key) Returns theStringat the given index, or null if it does not exist or is the wrong type.Returns theStringat the given index, or the default if it does not exist or is the wrong type.booleanhas(int key) Returns true if the array has an element at that index (even if that element is null).booleanisBoolean(int key) Returns true if the array has a boolean element at that index.booleanisNull(int key) Returns true if the array has a null element at that index.booleanisNumber(int key) Returns true if the array has a number element at that index.booleanisString(int key) Returns true if the array has a string element at that index.Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, ensureCapacity, equals, forEach, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeIf, removeLast, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class java.util.AbstractCollection
containsAll, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, stream, toArrayMethods inherited from interface java.util.List
containsAll, reversed
-
Constructor Details
-
Method Details
-
from
Creates aJsonArrayfrom an array of contents. -
builder
Creates aJsonBuilderfor aJsonArray. -
get
Returns the underlying object at the given index, or null if it does not exist. -
getArray
Returns theJsonArrayat the given index, or null if it does not exist or is the wrong type. -
getArray
Returns theJsonArrayat the given index, or the default if it does not exist or is the wrong type. -
getBoolean
public boolean getBoolean(int key) Returns theBooleanat the given index, or false if it does not exist or is the wrong type. -
getBoolean
Returns theBooleanat the given index, or the default if it does not exist or is the wrong type. -
getDouble
public double getDouble(int key) Returns theDoubleat the given index, or 0.0 if it does not exist or is the wrong type. -
getDouble
public double getDouble(int key, double default_) Returns theDoubleat the given index, or the default if it does not exist or is the wrong type. -
getFloat
public float getFloat(int key) Returns theFloatat the given index, or 0.0f if it does not exist or is the wrong type. -
getFloat
public float getFloat(int key, float default_) Returns theFloatat the given index, or the default if it does not exist or is the wrong type. -
getInt
public int getInt(int key) Returns theIntegerat the given index, or 0 if it does not exist or is the wrong type. -
getInt
public int getInt(int key, int default_) Returns theIntegerat the given index, or the default if it does not exist or is the wrong type. -
getLong
public long getLong(int key) Returns theLongat the given index, or 0 if it does not exist or is the wrong type. -
getLong
public long getLong(int key, long default_) Returns theLongat the given index, or the default if it does not exist or is the wrong type. -
getNumber
Returns theNumberat the given index, or null if it does not exist or is the wrong type. -
getNumber
Returns theNumberat the given index, or the default if it does not exist or is the wrong type. -
getObject
Returns theJsonObjectat the given index, or null if it does not exist or is the wrong type. -
getObject
Returns theJsonObjectat the given index, or the default if it does not exist or is the wrong type. -
getString
Returns theStringat the given index, or null if it does not exist or is the wrong type. -
getString
Returns theStringat the given index, or the default if it does not exist or is the wrong type. -
has
public boolean has(int key) Returns true if the array has an element at that index (even if that element is null). -
isBoolean
public boolean isBoolean(int key) Returns true if the array has a boolean element at that index. -
isNull
public boolean isNull(int key) Returns true if the array has a null element at that index. -
isNumber
public boolean isNumber(int key) Returns true if the array has a number element at that index. -
isString
public boolean isString(int key) Returns true if the array has a string element at that index.
-