Elements can be added using one of the add(name, value)
methods. Accepted values are either instances of {@link JsonValue}, strings, primitive numbers, or boolean values. To replace an element of an array, the set(name, value)
methods can be used.
Elements can be accessed by their index using {@link #get(int)}. This class also supports iterating over the elements in document order using an {@link #iterator()} or an enhanced forloop:
for( JsonValue value : jsonArray ) { ... }
An equivalent {@link List} can be obtained from the method {@link #values()}.
Note that this class is not thread-safe. If multiple threads access a JsonArray
instance concurrently, while at least one of these threads modifies the contents of this array, access to the instance must be synchronized externally. Failure to do so may lead to an inconsistent state.
This class is not supposed to be extended by clients.
|
|
|
|
|
|