Class JSONValueArrayMutable
- java.lang.Object
-
- com.github.tnakamot.json.value.JSONValue
-
- com.github.tnakamot.json.value.JSONValueStructured
-
- com.github.tnakamot.json.value.JSONValueArray
-
- com.github.tnakamot.json.value.JSONValueArrayMutable
-
public class JSONValueArrayMutable extends JSONValueArray
Represents one JSON 'array' value (mutable).This is a mutable version of
JSONValueArray
.- See Also:
JSONValueArrayImmutable
-
-
Constructor Summary
Constructors Constructor Description JSONValueArrayMutable()
Create an instance of a Java representation of an empty JSON 'array' value.JSONValueArrayMutable(List<JSONValue> values)
Create an instance of a Java representation of a JSON 'array' value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int i, JSONValue jsonValue)
boolean
add(JSONValue jsonValue)
boolean
addAll(int i, @NotNull Collection<? extends JSONValue> collection)
boolean
addAll(@NotNull Collection<? extends JSONValue> collection)
void
clear()
boolean
contains(Object o)
boolean
containsAll(@NotNull Collection collection)
JSONValue
get(int i)
int
indexOf(Object o)
boolean
isEmpty()
@NotNull Iterator<JSONValue>
iterator()
int
lastIndexOf(Object o)
@NotNull ListIterator<JSONValue>
listIterator()
@NotNull ListIterator<JSONValue>
listIterator(int i)
JSONValue
remove(int i)
boolean
remove(Object o)
boolean
removeAll(@NotNull Collection<?> collection)
boolean
retainAll(@NotNull Collection<?> collection)
JSONValue
set(int i, JSONValue jsonValue)
int
size()
@NotNull List<JSONValue>
subList(int i, int i1)
@NotNull Object[]
toArray()
<T> @NotNull T[]
toArray(T[] ts)
JSONValueArrayImmutable
toImmutable()
Return the copy of this JSON array as an immutable Java array.JSONValueArrayImmutable
toImmutable(JSONToken begin, JSONToken end)
Return the copy of this JSON array as an immutable Java array.@NotNull String
toTokenString()
Convert this JSON value toString
which can be saved as a JSON text to a file or transmitted to network.@NotNull String
toTokenString(String newline, String indent)
Convert this JSON value toString
which can be saved as a JSON text to a file or transmitted to network.-
Methods inherited from class com.github.tnakamot.json.value.JSONValueArray
add, add, add, add, equals, getArray, getBoolean, getDouble, getLong, getObject, getString, hashCode
-
Methods inherited from class com.github.tnakamot.json.value.JSONValueStructured
begin, end
-
Methods inherited from class com.github.tnakamot.json.value.JSONValue
toTokenBytes, toTokenBytes, type
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
replaceAll, sort, spliterator
-
-
-
-
Method Detail
-
size
public int size()
- Specified by:
size
in interfaceCollection<JSONValue>
- Specified by:
size
in interfaceList<JSONValue>
- Specified by:
size
in classJSONValueArray
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceCollection<JSONValue>
- Specified by:
isEmpty
in interfaceList<JSONValue>
- Specified by:
isEmpty
in classJSONValueArray
-
contains
public boolean contains(Object o)
- Specified by:
contains
in interfaceCollection<JSONValue>
- Specified by:
contains
in interfaceList<JSONValue>
- Specified by:
contains
in classJSONValueArray
-
toArray
@NotNull public @NotNull Object[] toArray()
- Specified by:
toArray
in interfaceCollection<JSONValue>
- Specified by:
toArray
in interfaceList<JSONValue>
- Specified by:
toArray
in classJSONValueArray
-
add
public boolean add(JSONValue jsonValue)
- Specified by:
add
in interfaceCollection<JSONValue>
- Specified by:
add
in interfaceList<JSONValue>
- Specified by:
add
in classJSONValueArray
-
remove
public boolean remove(Object o)
- Specified by:
remove
in interfaceCollection<JSONValue>
- Specified by:
remove
in interfaceList<JSONValue>
- Specified by:
remove
in classJSONValueArray
-
addAll
public boolean addAll(@NotNull @NotNull Collection<? extends JSONValue> collection)
- Specified by:
addAll
in interfaceCollection<JSONValue>
- Specified by:
addAll
in interfaceList<JSONValue>
- Specified by:
addAll
in classJSONValueArray
-
addAll
public boolean addAll(int i, @NotNull @NotNull Collection<? extends JSONValue> collection)
- Specified by:
addAll
in interfaceList<JSONValue>
- Specified by:
addAll
in classJSONValueArray
-
clear
public void clear()
- Specified by:
clear
in interfaceCollection<JSONValue>
- Specified by:
clear
in interfaceList<JSONValue>
- Specified by:
clear
in classJSONValueArray
-
get
public JSONValue get(int i)
- Specified by:
get
in interfaceList<JSONValue>
- Specified by:
get
in classJSONValueArray
-
set
public JSONValue set(int i, JSONValue jsonValue)
- Specified by:
set
in interfaceList<JSONValue>
- Specified by:
set
in classJSONValueArray
-
add
public void add(int i, JSONValue jsonValue)
- Specified by:
add
in interfaceList<JSONValue>
- Specified by:
add
in classJSONValueArray
-
remove
public JSONValue remove(int i)
- Specified by:
remove
in interfaceList<JSONValue>
- Specified by:
remove
in classJSONValueArray
-
indexOf
public int indexOf(Object o)
- Specified by:
indexOf
in interfaceList<JSONValue>
- Specified by:
indexOf
in classJSONValueArray
-
lastIndexOf
public int lastIndexOf(Object o)
- Specified by:
lastIndexOf
in interfaceList<JSONValue>
- Specified by:
lastIndexOf
in classJSONValueArray
-
listIterator
@NotNull public @NotNull ListIterator<JSONValue> listIterator()
- Specified by:
listIterator
in interfaceList<JSONValue>
- Specified by:
listIterator
in classJSONValueArray
-
listIterator
@NotNull public @NotNull ListIterator<JSONValue> listIterator(int i)
- Specified by:
listIterator
in interfaceList<JSONValue>
- Specified by:
listIterator
in classJSONValueArray
-
subList
@NotNull public @NotNull List<JSONValue> subList(int i, int i1)
- Specified by:
subList
in interfaceList<JSONValue>
- Specified by:
subList
in classJSONValueArray
-
retainAll
public boolean retainAll(@NotNull @NotNull Collection<?> collection)
- Specified by:
retainAll
in interfaceCollection<JSONValue>
- Specified by:
retainAll
in interfaceList<JSONValue>
- Specified by:
retainAll
in classJSONValueArray
-
removeAll
public boolean removeAll(@NotNull @NotNull Collection<?> collection)
- Specified by:
removeAll
in interfaceCollection<JSONValue>
- Specified by:
removeAll
in interfaceList<JSONValue>
- Specified by:
removeAll
in classJSONValueArray
-
containsAll
public boolean containsAll(@NotNull @NotNull Collection collection)
- Specified by:
containsAll
in interfaceCollection<JSONValue>
- Specified by:
containsAll
in interfaceList<JSONValue>
- Specified by:
containsAll
in classJSONValueArray
-
toArray
@NotNull public <T> @NotNull T[] toArray(T[] ts)
- Specified by:
toArray
in interfaceCollection<JSONValue>
- Specified by:
toArray
in interfaceList<JSONValue>
- Specified by:
toArray
in classJSONValueArray
-
toImmutable
public JSONValueArrayImmutable toImmutable()
Return the copy of this JSON array as an immutable Java array.All inner JSON objects and JSON arrays are also turned to be immutable.
- Returns:
- an immutable version of the same JSON array.
-
toImmutable
public JSONValueArrayImmutable toImmutable(JSONToken begin, JSONToken end)
Return the copy of this JSON array as an immutable Java array.All inner JSON objects and JSON arrays are also turned to be immutable.
- Parameters:
begin
- the beginning token of this JSON array. Null if this JSON array does not originate from an exsiting JSON text.end
- the end token of this JSON array. Null if this JSON array does not originate from an exsiting JSON text.- Returns:
- an immutable version of the same JSON array.
-
toTokenString
@NotNull public @NotNull String toTokenString()
Description copied from class:JSONValue
Convert this JSON value toString
which can be saved as a JSON text to a file or transmitted to network. The output text is optimized for machine, so no indent or new lines will be inserted.Note that, according to RFC 8259 - 8.1 Character Encoding, your application program must encode the returned String using UTF-8 without BOM before writing the returned
String
to a file or a network stream, or network datagram(s). It is caller's responsibility to correctly encode it.- Specified by:
toTokenString
in classJSONValue
- Returns:
- a string representation of this JSON value
-
toTokenString
@NotNull public @NotNull String toTokenString(String newline, String indent)
Description copied from class:JSONValue
Convert this JSON value toString
which can be saved as a JSON text to a file or transmitted to network. The output text is optimized for human. Indents and new line characters are inserted accordingly.Note that, according to RFC 8259 - 8.1 Character Encoding, your application program must encode the returned String using UTF-8 without BOM before writing the returned
String
to a file or a network stream, or network datagram(s). It is caller's responsibility to correctly encode it.- Specified by:
toTokenString
in classJSONValue
- Parameters:
newline
- line separator; "\r", "\n" or "\r\n"indent
- indent string. Must consist of " " and "\t".- Returns:
- a string representation of this JSON value
-
-