@ForUseOnly public interface JsonArray extends JsonElement<JsonArray>
CAUTION:
This class is still in development and may change drastically without any further notice.JsonOutput
Modifier and Type | Field and Description |
---|---|
static char |
DELIMITER
The default delimiter of an array in json '{'.
|
static char |
PREFIX
The default prefix of an array in json '['.
|
static char |
SUFFIX
The default suffix of an array in json ']'.
|
Modifier and Type | Method and Description |
---|---|
JsonArray |
add(Collection<? extends JsonElement<?>> values)
This method adds a collection of
JsonElement instances to the list. |
JsonArray |
add(JsonElement<?>... values)
This method adds one or more elements to the list.
|
static JsonArray |
create()
Create a new empty
JsonArray . |
JsonElement<?> |
get(int index)
Returns the
element at the specified position in this array. |
JsonArray |
remove(Collection<? extends JsonElement<?>> values)
This method removes a collection of
JsonElement instances from the list. |
JsonArray |
remove(JsonElement<?>... values)
This method removes the given {link JsonElement elements}.
|
int |
size()
Returns the number of elements in this list.
|
default Stream<JsonElement<?>> |
stream()
This method transforms the current values list to a stream and returns it.
|
Collection<JsonElement<?>> |
values()
Returns the current
values in a new collection . |
getValue
static final char PREFIX
static final char DELIMITER
static final char SUFFIX
static JsonArray create()
JsonArray
.JsonArray
@NotNull JsonArray add(@NotNull JsonElement<?>... values)
values
- The value(s) that should be added to the list (must not be null
).@NotNull JsonArray add(@NotNull Collection<? extends JsonElement<?>> values)
JsonElement
instances to the list.values
- The collection that holds the values that should be added (must not be null
).list
itself to do more actions if needed.@NotNull JsonArray remove(@NotNull JsonElement<?>... values)
values
- The value(s) that should be removed from the list.list
itself to do more actions if needed.@NotNull JsonArray remove(@NotNull Collection<? extends JsonElement<?>> values)
JsonElement
instances from the list.values
- The collection that holds the values that should be removed.list
itself to do more actions if needed.@NotNull JsonElement<?> get(int index)
element
at the specified position in this array.index
- index of the element
to returnelement
at the specified position in this arrayIndexOutOfBoundsException
- if the index is out of range
(index < 0 || index >= size())@NotNull Collection<JsonElement<?>> values()
values
in a new collection
.
NOTE:collection
will not modify the values
of this
array
. If you want to modify the values
of this array
you must use methods of this class
.
However, modifying the elements
will modify the actual elements
.
collection
containing the current values
add(JsonElement[])
,
add(Collection)
,
remove(JsonElement[])
,
remove(Collection)
int size()
@NotNull default Stream<JsonElement<?>> stream()
Stream
over the elements in this JsonArrayCopyright © 2021 e-Spirit AG. All Rights Reserved. Build 5.2.210210