Interface JsonArray
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description JsonArray
add(JsonNode jsonNode)
Adds aJsonNode
to the end of this array.JsonArray
clear()
Clears all values in the array.Stream<JsonNode>
elements()
JsonNode
get(int index)
Gets theJsonNode
at the given index of the array.boolean
has(int index)
Determines if the array contains a value for the given index.default boolean
isArray()
JsonNode
remove(int index)
Removes theJsonNode
at the specified index of the array.JsonNode
set(int index, JsonNode jsonNode)
Replaces theJsonNode
at the specified index with a new node.int
size()
-
-
-
Method Detail
-
isArray
default boolean isArray()
-
get
JsonNode get(int index)
Gets theJsonNode
at the given index of the array.- Parameters:
index
- Index of the array.- Returns:
- The
JsonNode
at the given index of the array if set, otherwisenull
. - Throws:
IndexOutOfBoundsException
- Ifindex
is less than0
or greater thansize()
.
-
has
boolean has(int index)
Determines if the array contains a value for the given index.If
index
is less than0
or greater than equal tosize()
false
is returned.- Parameters:
index
- Index of the array.- Returns:
- Whether the array contains a value for the index.
-
remove
JsonNode remove(int index)
Removes theJsonNode
at the specified index of the array.- Parameters:
index
- Index of the array.- Returns:
- The
JsonNode
at the given index of the array. - Throws:
IndexOutOfBoundsException
- Ifindex
is less than0
or greater thansize()
.
-
set
JsonNode set(int index, JsonNode jsonNode)
Replaces theJsonNode
at the specified index with a new node.- Parameters:
index
- Index of the array.jsonNode
- The newJsonNode
value to set.- Returns:
- The old
JsonNode
value at the given index of the array. - Throws:
IndexOutOfBoundsException
- Ifindex
is less than0
or greater thansize()
.
-
size
int size()
- Returns:
- The size of the array.
-
-