Package com.alibaba.fastjson
Class JSONArray
java.lang.Object
com.alibaba.fastjson.JSON
com.alibaba.fastjson.JSONArray
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<Object>,Collection<Object>,List<Object>
- See Also:
-
Field Summary
FieldsFields inherited from class com.alibaba.fastjson.JSON
DEFAULT_GENERATE_FEATURE, DEFAULT_PARSER_FEATURE, DEFAULT_TYPE_KEY, defaultLocale, defaultTimeZone, DEFFAULT_DATE_FORMAT, VERSION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanbooleanaddAll(int index, Collection c) booleanaddAll(Collection c) voidclear()clone()booleanbooleanbooleanfluentAddAll(Collection<?> c) fluentRemove(int index) fluentRemoveAll(Collection<?> c) get(int index) getBigDecimal(int index) getBigInteger(int index) getBoolean(int index) booleangetBooleanValue(int index) getByte(int index) bytegetByteValue(int index) Returns a byte value at the specified location in thisJSONArray.Deprecated.getDate(int index) getDouble(int index) doublegetDoubleValue(int index) Returns a double value at the specified location in thisJSONArray.getFloat(int index) floatgetFloatValue(int index) Returns a float value at the specified location in thisJSONArray.getInteger(int index) intgetIntValue(int index) getJSONArray(int index) getJSONObject(int index) getLong(int index) longgetLongValue(int index) <T> T<T> TDeprecated.getShort(int index) shortgetShortValue(int index) Returns a short value at the specified location in thisJSONArray.getSqlDate(int index) getString(int index) getTimestamp(int index) inthashCode()intbooleanisEmpty()iterator()intlistIterator(int index) remove(int index) booleanbooleanbooleanvoidsetComponentType(Type componentType) Deprecated.voidsetRelatedArray(Object relatedArray) Deprecated.intsize()subList(int fromIndex, int toIndex) Object[]toArray()Object[]<T> List<T>toJavaList(Class<T> clazz) <T> TtoJavaObject(Class<T> clazz) <T> TtoJavaObject(Type type) toString()Methods inherited from class com.alibaba.fastjson.JSON
addMixInAnnotations, clearMixInAnnotations, configFilter, createReadContext, createWriteContext, getMixInAnnotations, isValid, isValidArray, isValidObject, parse, parse, parse, parse, parse, parse, parse, parse, parse, parseArray, parseArray, parseArray, parseArray, parseArray, parseArray, parseObject, parseObject, parseObject, parseObject, parseObject, parseObject, parseObject, parseObject, parseObject, parseObject, parseObject, parseObject, parseObject, parseObject, parseObject, parseObject, parseObject, parseObject, parseObject, parseObject, parseObject, parseObject, parseObject, parseObject, parseObject, parseObject, removeMixInAnnotations, toJavaObject, toJavaObject, toJSON, toJSON, toJSON, toJSONBytes, toJSONBytes, toJSONBytes, toJSONBytes, toJSONBytes, toJSONBytes, toJSONBytes, toJSONBytes, toJSONBytes, toJSONBytes, toJSONBytes, toJSONBytes, toJSONBytes, toJSONString, toJSONString, toJSONString, toJSONString, toJSONString, toJSONString, toJSONString, toJSONString, toJSONString, toJSONString, toJSONString, toJSONString, toJSONStringWithDateFormat, toJSONStringZ, toString, writeJSONString, writeJSONString, writeJSONString, writeJSONString, writeJSONString, writeJSONString, writeJSONString, writeJSONString, writeJSONStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
replaceAll, sort, spliterator
-
Field Details
-
componentType
-
Constructor Details
-
JSONArray
public JSONArray() -
JSONArray
-
JSONArray
public JSONArray(int initialCapacity)
-
-
Method Details
-
getByte
-
getShort
-
getFloat
-
getDouble
-
getIntValue
public int getIntValue(int index) -
getBigDecimal
-
getLongValue
public long getLongValue(int index) -
getInteger
-
getLong
-
getBooleanValue
public boolean getBooleanValue(int index) -
getBoolean
-
getJSONObject
-
size
public int size() -
isEmpty
public boolean isEmpty() -
contains
-
iterator
-
toArray
-
toArray
-
add
-
remove
-
addAll
-
addAll
-
clear
public void clear() -
fluentClear
-
fluentRemove
-
fluentRemove
-
fluentSet
-
fluentRemoveAll
-
fluentAddAll
-
getShortValue
public short getShortValue(int index) Returns a short value at the specified location in thisJSONArray.- Parameters:
index- index of the element to return- Returns:
- short
- Throws:
NumberFormatException- If the value of get isStringand it contains no parsable shortJSONException- Unsupported type conversion to short valueIndexOutOfBoundsException- if the index is out of range(index < 0 || index >= size())
-
getFloatValue
public float getFloatValue(int index) Returns a float value at the specified location in thisJSONArray.- Parameters:
index- index of the element to return- Returns:
- float
- Throws:
NumberFormatException- If the value of get isStringand it contains no parsable floatJSONException- Unsupported type conversion to float valueIndexOutOfBoundsException- if the index is out of range(index < 0 || index >= size())
-
getDoubleValue
public double getDoubleValue(int index) Returns a double value at the specified location in thisJSONArray.- Parameters:
index- index of the element to return- Returns:
- double
- Throws:
NumberFormatException- If the value of get isStringand it contains no parsable doubleJSONException- Unsupported type conversion to double valueIndexOutOfBoundsException- if the index is out of range(index < 0 || index >= size())
-
retainAll
-
removeAll
-
containsAll
- Specified by:
containsAllin interfaceCollection<Object>- Specified by:
containsAllin interfaceList<Object>
-
get
-
getByteValue
public byte getByteValue(int index) Returns a byte value at the specified location in thisJSONArray.- Parameters:
index- index of the element to return- Returns:
- byte
- Throws:
NumberFormatException- If the value of get isStringand it contains no parsable byteJSONException- Unsupported type conversion to byte valueIndexOutOfBoundsException- if the index is out of range(index < 0 || index >= size())
-
getBigInteger
-
getSqlDate
-
getTimestamp
-
getDate
-
set
-
add
-
remove
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<Object>
-
listIterator
- Specified by:
listIteratorin interfaceList<Object>
-
listIterator
- Specified by:
listIteratorin interfaceList<Object>
-
subList
-
getString
-
getJSONArray
-
getObject
-
getObject
-
toJavaList
-
fluentAdd
-
toJavaObject
- Specified by:
toJavaObjectin classJSON
-
toString
-
clone
-
hashCode
public int hashCode() -
equals
-
toJavaObject
- Specified by:
toJavaObjectin classJSON
-
getComponentType
Deprecated. -
setComponentType
Deprecated. -
getRelatedArray
Deprecated. -
setRelatedArray
Deprecated.
-