Package de.espirit.firstspirit.json
Interface JsonArray
- All Superinterfaces:
JsonElement<JsonArray>,de.espirit.firstspirit.json.JsonOutput
The interface for json arrays.
- Since:
- 5.2.191206
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescription@NotNull JsonArrayadd(@NotNull JsonElement<?>... values) This method adds one or more elements to the list.@NotNull JsonArrayadd(@NotNull Collection<? extends JsonElement<?>> values) This method adds a collection ofJsonElementinstances to the list.static JsonArraycreate()Create a new emptyJsonArray.@NotNull JsonElement<?>get(int index) Returns theelementat the specified position in this array.@NotNull JsonArrayremove(@NotNull JsonElement<?>... values) This method removes the given {link JsonElement elements}.@NotNull JsonArrayremove(@NotNull Collection<? extends JsonElement<?>> values) This method removes a collection ofJsonElementinstances from the list.intsize()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 currentvaluesin a newcollection.Methods inherited from interface de.espirit.firstspirit.json.JsonElement
getValueMethods 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 ofJsonElementinstances to the list.- Parameters:
values- The collection that holds the values that should be added (must not benull).- Returns:
- The
listitself 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
listitself to do more actions if needed. - Since:
- 5.2.191206
-
remove
This method removes a collection ofJsonElementinstances from the list.- Parameters:
values- The collection that holds the values that should be removed.- Returns:
- The
listitself to do more actions if needed. - Since:
- 5.2.191206
-
get
Returns theelementat the specified position in this array.- Parameters:
index- index of theelementto return- Returns:
- the
elementat 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 currentvaluesin a newcollection.
NOTE:
Modifying the returnedcollectionwill not modify thevaluesof thisarray. If you want to modify thevaluesof thisarrayyou must use methods ofthis class.However, modifying the
elementswill modify the actualelements.- Returns:
- a new
collectioncontaining 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_VALUEelements, 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
Streamover the elements in this JsonArray - Since:
- 5.2.191206
-