Package jsonvalues
Class MutableJsons.MutableJsArrays
- java.lang.Object
-
- jsonvalues.MutableJsons.MutableJsArrays
-
- Enclosing class:
- MutableJsons
public class MutableJsons.MutableJsArrays extends Object
represents a factory of mutable Json arrays
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collector<JsPair,JsArray,JsArray>
collector()
Returns a collector that accumulates the pairs from a stream into a mutable array.JsArray
empty()
Returns a mutable empty array.JsArray
of(boolean bool, boolean... others)
Returns a mutable array from one or more booleans.JsArray
of(double number, double... others)
Returns a mutable array from one or more doubles.JsArray
of(int number, int... others)
Returns a mutable array from one or more integers.JsArray
of(long number, long... others)
Returns a mutable array from one or more longs.JsArray
of(String str, String... others)
Returns a mutable array from one or more strings.JsArray
of(JsElem e)
Returns a mutable one-element array.JsArray
of(JsElem e, JsElem e1)
Returns an mutable two-element array.JsArray
of(JsElem e, JsElem e1, JsElem e2)
Returns an mutable three-element array.JsArray
of(JsElem e, JsElem e1, JsElem e2, JsElem e3)
Returns a mutable four-element array.JsArray
of(JsElem e, JsElem e1, JsElem e2, JsElem e3, JsElem e4)
Returns an mutable five-element array.JsArray
of(JsElem e, JsElem e1, JsElem e2, JsElem e3, JsElem e4, JsElem... rest)
Returns an mutable array.JsArray
of(JsPair pair, JsPair... others)
Returns an immutable array from one or more pairs.JsArray
ofIterable(Iterable<JsElem> iterable)
TryArr
parse(String str)
Tries to parse the string into a mutable json array.TryArr
parse(String str, ParseBuilder builder)
Tries to parse the string into an mutable array, performing the specified transformations during the parsing.JsArray
toMutable(JsArray array)
-
-
-
Method Detail
-
collector
public Collector<JsPair,JsArray,JsArray> collector()
Returns a collector that accumulates the pairs from a stream into a mutable array.- Returns:
- a Collector which collects all the pairs of elements into a mutable JsArray, in encounter order
-
empty
public JsArray empty()
Returns a mutable empty array.- Returns:
- mutable empty JsArray
-
parse
public TryArr parse(String str)
Tries to parse the string into a mutable json array.- Parameters:
str
- the string to be parsed- Returns:
- a
TryArr
computation
-
parse
public TryArr parse(String str, ParseBuilder builder)
Tries to parse the string into an mutable array, performing the specified transformations during the parsing. It's faster to do certain operations right while the parsing instead of doing the parsing and applying them later.- Parameters:
str
- string to be parsedbuilder
- builder with the transformations that will be applied during the parsing- Returns:
- a
TryArr
computation
-
of
public JsArray of(String str, String... others)
Returns a mutable array from one or more strings.- Parameters:
str
- a stringothers
- more optional strings- Returns:
- a mutable JsArray
-
of
public JsArray of(JsElem e)
Returns a mutable one-element array.- Parameters:
e
- a JsElem- Returns:
- a mutable one-element JsArray
- Throws:
UserError
- if the elem is an immutable Json
-
of
public JsArray of(JsElem e, JsElem e1)
Returns an mutable two-element array.- Parameters:
e
- a JsEleme1
- a JsElem- Returns:
- an mutable two-element JsArray
- Throws:
UserError
- if an elem is an immutable Json
-
of
public JsArray of(JsElem e, JsElem e1, JsElem e2)
Returns an mutable three-element array.- Parameters:
e
- a JsEleme1
- a JsEleme2
- a JsElem- Returns:
- an mutable three-element JsArray
- Throws:
UserError
- if an elem is a immutable Json
-
of
public JsArray of(JsElem e, JsElem e1, JsElem e2, JsElem e3)
Returns a mutable four-element array.- Parameters:
e
- a JsEleme1
- a JsEleme2
- a JsEleme3
- a JsElem- Returns:
- an mutable four-element JsArray
- Throws:
UserError
- if an elem is an immutable Json
-
of
public JsArray of(JsElem e, JsElem e1, JsElem e2, JsElem e3, JsElem e4)
Returns an mutable five-element array.- Parameters:
e
- a JsEleme1
- a JsEleme2
- a JsEleme3
- a JsEleme4
- a JsElem- Returns:
- an mutable five-element JsArray
- Throws:
UserError
- if an elem is a immutable Json
-
of
public JsArray of(JsElem e, JsElem e1, JsElem e2, JsElem e3, JsElem e4, JsElem... rest)
Returns an mutable array.- Parameters:
e
- a JsEleme1
- a JsEleme2
- a JsEleme3
- a JsEleme4
- a JsElemrest
- more optional JsElem- Returns:
- an mutable JsArray
- Throws:
UserError
- if an elem is an immutable Json
-
of
public JsArray of(int number, int... others)
Returns a mutable array from one or more integers.- Parameters:
number
- an integerothers
- more optional integers- Returns:
- a mutable JsArray
-
of
public JsArray of(long number, long... others)
Returns a mutable array from one or more longs.- Parameters:
number
- a longothers
- more optional longs- Returns:
- a mutable JsArray
-
of
public JsArray of(boolean bool, boolean... others)
Returns a mutable array from one or more booleans.- Parameters:
bool
- a booleanothers
- more optional booleans- Returns:
- a mutable JsArray
-
of
public JsArray of(double number, double... others)
Returns a mutable array from one or more doubles.- Parameters:
number
- a doubleothers
- more optional doubles- Returns:
- a mutable JsArray
-
-