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 voidadd(int i, JSONValue jsonValue)booleanadd(JSONValue jsonValue)booleanaddAll(int i, @NotNull Collection<? extends JSONValue> collection)booleanaddAll(@NotNull Collection<? extends JSONValue> collection)voidclear()booleancontains(Object o)booleancontainsAll(@NotNull Collection collection)JSONValueget(int i)intindexOf(Object o)booleanisEmpty()@NotNull Iterator<JSONValue>iterator()intlastIndexOf(Object o)@NotNull ListIterator<JSONValue>listIterator()@NotNull ListIterator<JSONValue>listIterator(int i)JSONValueremove(int i)booleanremove(Object o)booleanremoveAll(@NotNull Collection<?> collection)booleanretainAll(@NotNull Collection<?> collection)JSONValueset(int i, JSONValue jsonValue)intsize()@NotNull List<JSONValue>subList(int i, int i1)@NotNull Object[]toArray()<T> @NotNull T[]toArray(T[] ts)JSONValueArrayImmutabletoImmutable()Return the copy of this JSON array as an immutable Java array.JSONValueArrayImmutabletoImmutable(JSONToken begin, JSONToken end)Return the copy of this JSON array as an immutable Java array.@NotNull StringtoTokenString()Convert this JSON value toStringwhich can be saved as a JSON text to a file or transmitted to network.@NotNull StringtoTokenString(String newline, String indent)Convert this JSON value toStringwhich 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:
sizein interfaceCollection<JSONValue>- Specified by:
sizein interfaceList<JSONValue>- Specified by:
sizein classJSONValueArray
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceCollection<JSONValue>- Specified by:
isEmptyin interfaceList<JSONValue>- Specified by:
isEmptyin classJSONValueArray
-
contains
public boolean contains(Object o)
- Specified by:
containsin interfaceCollection<JSONValue>- Specified by:
containsin interfaceList<JSONValue>- Specified by:
containsin classJSONValueArray
-
toArray
@NotNull public @NotNull Object[] toArray()
- Specified by:
toArrayin interfaceCollection<JSONValue>- Specified by:
toArrayin interfaceList<JSONValue>- Specified by:
toArrayin classJSONValueArray
-
add
public boolean add(JSONValue jsonValue)
- Specified by:
addin interfaceCollection<JSONValue>- Specified by:
addin interfaceList<JSONValue>- Specified by:
addin classJSONValueArray
-
remove
public boolean remove(Object o)
- Specified by:
removein interfaceCollection<JSONValue>- Specified by:
removein interfaceList<JSONValue>- Specified by:
removein classJSONValueArray
-
addAll
public boolean addAll(@NotNull @NotNull Collection<? extends JSONValue> collection)- Specified by:
addAllin interfaceCollection<JSONValue>- Specified by:
addAllin interfaceList<JSONValue>- Specified by:
addAllin classJSONValueArray
-
addAll
public boolean addAll(int i, @NotNull @NotNull Collection<? extends JSONValue> collection)- Specified by:
addAllin interfaceList<JSONValue>- Specified by:
addAllin classJSONValueArray
-
clear
public void clear()
- Specified by:
clearin interfaceCollection<JSONValue>- Specified by:
clearin interfaceList<JSONValue>- Specified by:
clearin classJSONValueArray
-
get
public JSONValue get(int i)
- Specified by:
getin interfaceList<JSONValue>- Specified by:
getin classJSONValueArray
-
set
public JSONValue set(int i, JSONValue jsonValue)
- Specified by:
setin interfaceList<JSONValue>- Specified by:
setin classJSONValueArray
-
add
public void add(int i, JSONValue jsonValue)- Specified by:
addin interfaceList<JSONValue>- Specified by:
addin classJSONValueArray
-
remove
public JSONValue remove(int i)
- Specified by:
removein interfaceList<JSONValue>- Specified by:
removein classJSONValueArray
-
indexOf
public int indexOf(Object o)
- Specified by:
indexOfin interfaceList<JSONValue>- Specified by:
indexOfin classJSONValueArray
-
lastIndexOf
public int lastIndexOf(Object o)
- Specified by:
lastIndexOfin interfaceList<JSONValue>- Specified by:
lastIndexOfin classJSONValueArray
-
listIterator
@NotNull public @NotNull ListIterator<JSONValue> listIterator()
- Specified by:
listIteratorin interfaceList<JSONValue>- Specified by:
listIteratorin classJSONValueArray
-
listIterator
@NotNull public @NotNull ListIterator<JSONValue> listIterator(int i)
- Specified by:
listIteratorin interfaceList<JSONValue>- Specified by:
listIteratorin classJSONValueArray
-
subList
@NotNull public @NotNull List<JSONValue> subList(int i, int i1)
- Specified by:
subListin interfaceList<JSONValue>- Specified by:
subListin classJSONValueArray
-
retainAll
public boolean retainAll(@NotNull @NotNull Collection<?> collection)- Specified by:
retainAllin interfaceCollection<JSONValue>- Specified by:
retainAllin interfaceList<JSONValue>- Specified by:
retainAllin classJSONValueArray
-
removeAll
public boolean removeAll(@NotNull @NotNull Collection<?> collection)- Specified by:
removeAllin interfaceCollection<JSONValue>- Specified by:
removeAllin interfaceList<JSONValue>- Specified by:
removeAllin classJSONValueArray
-
containsAll
public boolean containsAll(@NotNull @NotNull Collection collection)- Specified by:
containsAllin interfaceCollection<JSONValue>- Specified by:
containsAllin interfaceList<JSONValue>- Specified by:
containsAllin classJSONValueArray
-
toArray
@NotNull public <T> @NotNull T[] toArray(T[] ts)
- Specified by:
toArrayin interfaceCollection<JSONValue>- Specified by:
toArrayin interfaceList<JSONValue>- Specified by:
toArrayin 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:JSONValueConvert this JSON value toStringwhich 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
Stringto a file or a network stream, or network datagram(s). It is caller's responsibility to correctly encode it.- Specified by:
toTokenStringin classJSONValue- Returns:
- a string representation of this JSON value
-
toTokenString
@NotNull public @NotNull String toTokenString(String newline, String indent)
Description copied from class:JSONValueConvert this JSON value toStringwhich 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
Stringto a file or a network stream, or network datagram(s). It is caller's responsibility to correctly encode it.- Specified by:
toTokenStringin 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
-
-