Package de.espirit.firstspirit.json
Interface JsonArray
- All Superinterfaces:
JsonElement<JsonArray>
,de.espirit.firstspirit.json.JsonOutput
The interface for json arrays.
CAUTION:
This class is still in development and may change drastically without any further notice.- Since:
- 5.2.191206
- See Also:
-
JsonOutput
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescription@NotNull JsonArray
add
(@NotNull JsonElement<?>... values) This method adds one or more elements to the list.@NotNull JsonArray
add
(@NotNull Collection<? extends JsonElement<?>> values) This method adds a collection ofJsonElement
instances to the list.static JsonArray
create()
Create a new emptyJsonArray
.@NotNull JsonElement<?>
get
(int index) Returns theelement
at the specified position in this array.@NotNull JsonArray
remove
(@NotNull JsonElement<?>... values) This method removes the given {link JsonElement elements}.@NotNull JsonArray
remove
(@NotNull Collection<? extends JsonElement<?>> values) This method removes a collection ofJsonElement
instances from the list.int
size()
Returns the number of elements in this list.default @NotNull Stream<JsonElement<?>>
stream()
This method transforms the current values list to a stream and returns it.@NotNull Collection<JsonElement<?>>
values()
Returns the currentvalues
in a newcollection
.Methods inherited from interface de.espirit.firstspirit.json.JsonElement
getValue
Methods inherited from interface de.espirit.firstspirit.json.JsonOutput
json, writeTo
-
Field Details
-
PREFIX
static final char PREFIXThe default prefix of an array in json '['.- Since:
- 5.2.191206
- See Also:
-
DELIMITER
static final char DELIMITERThe default delimiter of an array in json '{'.- Since:
- 5.2.191206
- See Also:
-
SUFFIX
static final char SUFFIXThe default suffix of an array in json ']'.- Since:
- 5.2.191206
- See Also:
-
-
Method Details
-
create
Create a new emptyJsonArray
.- Returns:
- a new
JsonArray
- Since:
- 5.2.191206
-
add
This method adds one or more elements to the list.- Parameters:
values
- The value(s) that should be added to the list (must not benull
).- Returns:
- The list itself to do more actions if needed.
- Since:
- 5.2.191206
-
add
This method adds a collection ofJsonElement
instances to the list.- Parameters:
values
- The collection that holds the values that should be added (must not benull
).- Returns:
- The
list
itself to do more actions if needed. - Since:
- 5.2.191206
-
remove
This method removes the given {link JsonElement elements}.- Parameters:
values
- The value(s) that should be removed from the list.- Returns:
- The
list
itself to do more actions if needed. - Since:
- 5.2.191206
-
remove
This method removes a collection ofJsonElement
instances from the list.- Parameters:
values
- The collection that holds the values that should be removed.- Returns:
- The
list
itself to do more actions if needed. - Since:
- 5.2.191206
-
get
Returns theelement
at the specified position in this array.- Parameters:
index
- index of theelement
to return- Returns:
- the
element
at the specified position in this array - Throws:
IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= size()
)- Since:
- 5.2.191206
-
values
Returns the currentvalues
in a newcollection
.
NOTE:
Modifying the returnedcollection
will not modify thevalues
of thisarray
. If you want to modify thevalues
of thisarray
you must use methods ofthis class
.However, modifying the
elements
will modify the actualelements
.- Returns:
- a new
collection
containing the currentvalues
- Since:
- 5.2.191206
- See Also:
-
size
int size()Returns the number of elements in this list. If this list contains more thanInteger.MAX_VALUE
elements, returnsInteger.MAX_VALUE
.- Returns:
- the number of elements in this list
- Since:
- 5.2.191206
-
stream
This method transforms the current values list to a stream and returns it.- Returns:
- A sequential
Stream
over the elements in this JsonArray - Since:
- 5.2.191206
-