- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList
-
- org.jooq.tools.json.JSONArray
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable
,Collection
,List
,RandomAccess
public class JSONArray extends ArrayList
A JSON array. JSONObject supports java.util.List interface.- Author:
- FangYidong<fangyidong@yahoo.com.cn>
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description JSONArray()
Constructs an empty JSONArray.JSONArray(Collection c)
Constructs a JSONArray containing the elements of the specified collection, in the order they are returned by the collection's iterator.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String
toJSONString(List<?> list)
Convert a list to JSON text.String
toString()
static void
writeJSONString(List<?> list, Writer out)
Encode a list into JSON text and write it to out.-
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
Methods inherited from class java.util.AbstractCollection
containsAll
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
-
Methods inherited from interface java.util.List
containsAll
-
-
-
-
Constructor Detail
-
JSONArray
public JSONArray()
Constructs an empty JSONArray.
-
JSONArray
public JSONArray(Collection c)
Constructs a JSONArray containing the elements of the specified collection, in the order they are returned by the collection's iterator.- Parameters:
c
- the collection whose elements are to be placed into this JSONArray
-
-
Method Detail
-
writeJSONString
public static void writeJSONString(List<?> list, Writer out) throws IOException
Encode a list into JSON text and write it to out.- Throws:
IOException
- See Also:
JSONValue.writeJSONString(Object, Writer)
-
toJSONString
public static String toJSONString(List<?> list)
Convert a list to JSON text. The result is a JSON array.- Returns:
- JSON text, or "null" if list is null.
- See Also:
JSONValue.toJSONString(Object)
-
toString
public String toString()
- Overrides:
toString
in classAbstractCollection
-
-