Package com.alibaba.fastjson
Class JSONArray
java.lang.Object
com.alibaba.fastjson.JSON
com.alibaba.fastjson.JSONArray
- All Implemented Interfaces:
JSONAware
,Serializable
,Cloneable
,Iterable<Object>
,Collection<Object>
,List<Object>
- See Also:
-
Field Summary
Fields inherited from class com.alibaba.fastjson.JSON
DEFAULT_GENERATE_FEATURE, DEFAULT_PARSER_FEATURE, DEFAULT_TYPE_KEY, defaultLocale, defaultTimeZone, DEFFAULT_DATE_FORMAT, VERSION
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
boolean
boolean
addAll
(int index, Collection c) boolean
addAll
(Collection c) void
clear()
clone()
boolean
boolean
boolean
fluentAddAll
(Collection<?> c) fluentRemove
(int index) fluentRemoveAll
(Collection<?> c) get
(int index) getBigDecimal
(int index) getBigInteger
(int index) getBoolean
(int index) boolean
getBooleanValue
(int index) getByte
(int index) byte
getByteValue
(int index) Returns a byte value at the specified location in thisJSONArray
.Deprecated.getDate
(int index) getDouble
(int index) double
getDoubleValue
(int index) Returns a double value at the specified location in thisJSONArray
.getFloat
(int index) float
getFloatValue
(int index) Returns a float value at the specified location in thisJSONArray
.getInteger
(int index) int
getIntValue
(int index) getJSONArray
(int index) getJSONObject
(int index) getLong
(int index) long
getLongValue
(int index) <T> T
<T> T
Deprecated.getShort
(int index) short
getShortValue
(int index) Returns a short value at the specified location in thisJSONArray
.getSqlDate
(int index) getString
(int index) getTimestamp
(int index) int
hashCode()
int
boolean
isEmpty()
iterator()
int
listIterator
(int index) remove
(int index) boolean
boolean
boolean
void
setComponentType
(Type componentType) Deprecated.void
setRelatedArray
(Object relatedArray) Deprecated.int
size()
subList
(int fromIndex, int toIndex) Object[]
toArray()
Object[]
<T> List<T>
toJavaList
(Class<T> clazz) <T> T
toJavaObject
(Class<T> clazz) <T> T
toJavaObject
(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, writeJSONString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods 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 isString
and 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 isString
and 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 isString
and 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:
containsAll
in interfaceCollection<Object>
- Specified by:
containsAll
in 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 isString
and 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:
lastIndexOf
in interfaceList<Object>
-
listIterator
- Specified by:
listIterator
in interfaceList<Object>
-
listIterator
- Specified by:
listIterator
in interfaceList<Object>
-
subList
-
getString
-
getJSONArray
-
getObject
-
getObject
-
toJavaList
-
fluentAdd
-
toJavaObject
- Specified by:
toJavaObject
in classJSON
-
toString
-
clone
-
hashCode
public int hashCode() -
equals
-
toJavaObject
- Specified by:
toJavaObject
in classJSON
-
getComponentType
Deprecated. -
setComponentType
Deprecated. -
getRelatedArray
Deprecated. -
setRelatedArray
Deprecated.
-