Package io.keikai.json
Class JSONArray<T>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList<T>
-
- io.keikai.json.JSONArray<T>
-
- All Implemented Interfaces:
JSONAware
,Serializable
,Cloneable
,Iterable<T>
,Collection<T>
,List<T>
,RandomAccess
public class JSONArray<T> extends ArrayList<T> implements List<T>, JSONAware
A JSON array. JSONObject supports java.util.List interface.- Author:
- FangYidong
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description JSONArray()
JSONArray(Collection<? extends T> c)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
toJSONString()
Encodes this object to a JSON string.static String
toJSONString(boolean[] ary)
Convert a boolean array to JSON text.static String
toJSONString(byte[] ary)
Convert a byte array to JSON text.static String
toJSONString(char[] ary)
Convert a char array to JSON text.static String
toJSONString(double[] ary)
Convert a double array to JSON text.static String
toJSONString(float[] ary)
Convert a float array to JSON text.static String
toJSONString(int[] ary)
Convert an integer array to JSON text.static String
toJSONString(long[] ary)
Convert a long array to JSON text.static String
toJSONString(short[] ary)
Convert a short array to JSON text.static String
toJSONString(Object[] ary)
Convert an object array to JSON text.static String
toJSONString(Collection collection)
Convert a list to JSON text.String
toString()
Encodes this object to a JSON string.-
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, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
-
-
-
-
Constructor Detail
-
JSONArray
public JSONArray()
-
JSONArray
public JSONArray(Collection<? extends T> c)
-
-
Method Detail
-
toJSONString
public static String toJSONString(Collection collection)
Convert a list to JSON text. The result is a JSON array. If this list is also a JSONAware, JSONAware specific behaviors will be omitted at this top level.- Parameters:
collection
-- Returns:
- JSON text, or "null" if list is null.
- See Also:
JSONValue.toJSONString(Object)
-
toJSONString
public static String toJSONString(Object[] ary)
Convert an object array to JSON text.patched by tomyeh
-
toJSONString
public static String toJSONString(int[] ary)
Convert an integer array to JSON text.patched by tomyeh
-
toJSONString
public static String toJSONString(long[] ary)
Convert a long array to JSON text.patched by tomyeh
-
toJSONString
public static String toJSONString(short[] ary)
Convert a short array to JSON text.patched by tomyeh
-
toJSONString
public static String toJSONString(float[] ary)
Convert a float array to JSON text.patched by tomyeh
-
toJSONString
public static String toJSONString(double[] ary)
Convert a double array to JSON text.patched by tomyeh
-
toJSONString
public static String toJSONString(byte[] ary)
Convert a byte array to JSON text.patched by tomyeh
-
toJSONString
public static String toJSONString(boolean[] ary)
Convert a boolean array to JSON text.patched by tomyeh
-
toJSONString
public static String toJSONString(char[] ary)
Convert a char array to JSON text.patched by tomyeh
-
toJSONString
public String toJSONString()
Encodes this object to a JSON string. It is the same astoString()
.- Specified by:
toJSONString
in interfaceJSONAware
- Returns:
- JSON text
-
toString
public String toString()
Encodes this object to a JSON string. It is the same astoJSONString()
.- Overrides:
toString
in classAbstractCollection<T>
-
-