Package jsonvalues

Class MutableJsons.MutableJsArrays

  • Enclosing class:
    MutableJsons

    public class MutableJsons.MutableJsArrays
    extends Object
    represents a factory of mutable Json arrays
    • 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 parsed
        builder - 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 string
        others - 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 JsElem
        e1 - 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 JsElem
        e1 - a JsElem
        e2 - 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 JsElem
        e1 - a JsElem
        e2 - a JsElem
        e3 - 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 JsElem
        e1 - a JsElem
        e2 - a JsElem
        e3 - a JsElem
        e4 - 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 JsElem
        e1 - a JsElem
        e2 - a JsElem
        e3 - a JsElem
        e4 - a JsElem
        rest - 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 integer
        others - 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 long
        others - 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 boolean
        others - 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 double
        others - more optional doubles
        Returns:
        a mutable JsArray
      • of

        public JsArray of​(JsPair pair,
                          JsPair... others)
        Returns an immutable array from one or more pairs.
        Parameters:
        pair - a pair
        others - more optional pairs
        Returns:
        an immutable JsArray
        Throws:
        UserError - if an elem of a pair is mutable