Class Array

    • Method Detail

      • toMutable

        @NonNull
        public MutableArray toMutable()
        Return a mutable copy of the array
        Returns:
        the MutableArray instance
      • count

        public final int count()
        Gets a number of the items in the array.
        Returns:
        the size of the array
      • getValue

        @Nullable
        public Object getValue​(int index)
        Gets value at the given index as an object. The object types are Blob, Array, Dictionary, Number, or String based on the underlying data type; or nil if the value is nil.
        Parameters:
        index - the index. This value must not exceed the bounds of the array.
        Returns:
        the Object or null.
      • getString

        @Nullable
        public String getString​(int index)
        Gets value at the given index as a String. Returns null if the value doesn't exist, or its value is not a String.
        Parameters:
        index - the index. This value must not exceed the bounds of the array.
        Returns:
        the String or null.
      • getNumber

        @Nullable
        public Number getNumber​(int index)
        Gets value at the given index as a Number. Returns null if the value doesn't exist, or its value is not a Number.
        Parameters:
        index - the index. This value must not exceed the bounds of the array.
        Returns:
        the Number or nil.
      • getInt

        public int getInt​(int index)
        Gets value at the given index as an int. Floating point values will be rounded. The value `true` is returned as 1, `false` as 0. Returns 0 if the value doesn't exist or does not have a numeric value.
        Parameters:
        index - the index. This value must not exceed the bounds of the array.
        Returns:
        the int value.
      • getLong

        public long getLong​(int index)
        Gets value at the given index as an long. Floating point values will be rounded. The value `true` is returned as 1, `false` as 0. Returns 0 if the value doesn't exist or does not have a numeric value.
        Parameters:
        index - the index. This value must not exceed the bounds of the array.
        Returns:
        the long value.
      • getFloat

        public float getFloat​(int index)
        Gets value at the given index as an float. Integers will be converted to float. The value `true` is returned as 1.0, `false` as 0.0. Returns 0.0 if the value doesn't exist or does not have a numeric value.
        Parameters:
        index - the index. This value must not exceed the bounds of the array.
        Returns:
        the float value.
      • getDouble

        public double getDouble​(int index)
        Gets value at the given index as an double. Integers will be converted to double. The value `true` is returned as 1.0, `false` as 0.0. Returns 0.0 if the property doesn't exist or does not have a numeric value.
        Parameters:
        index - the index. This value must not exceed the bounds of the array.
        Returns:
        the double value.
      • getBoolean

        public boolean getBoolean​(int index)
        Gets value at the given index as a boolean.
        Parameters:
        index - the index. This value must not exceed the bounds of the array.
        Returns:
        the boolean value.
      • getBlob

        @Nullable
        public Blob getBlob​(int index)
        Gets value at the given index as a Blob. Returns null if the value doesn't exist, or its value is not a Blob.
        Parameters:
        index - the index. This value must not exceed the bounds of the array.
        Returns:
        the Blob value or null.
      • getDate

        @Nullable
        public Date getDate​(int index)
        Gets value at the given index as a Date. JSON does not directly support dates, so the actual property value must be a string, which is then parsed according to the ISO-8601 date format (the default used in JSON.) Returns null if the value doesn't exist, is not a string, or is not parsable as a date. NOTE: This is not a generic date parser! It only recognizes the ISO-8601 format, with or without milliseconds.
        Parameters:
        index - the index. This value must not exceed the bounds of the array.
        Returns:
        the Date value or null.
      • getArray

        @Nullable
        public Array getArray​(int index)
        Gets a Array at the given index. Return null if the value is not an array.
        Parameters:
        index - the index. This value must not exceed the bounds of the array.
        Returns:
        the Array object.
      • getDictionary

        @Nullable
        public Dictionary getDictionary​(int index)
        Gets a Dictionary at the given index. Return null if the value is not an dictionary.
        Parameters:
        index - the index. This value must not exceed the bounds of the array.
        Returns:
        the Dictionary object.
      • toList

        @NonNull
        public List<Object> toList()
        Gets content of the current object as an List. The values contained in the returned List object are all JSON based values.
        Returns:
        the List object representing the content of the current object in the JSON format.
      • toJSON

        @NonNull
        public String toJSON()
      • encodeTo

        public void encodeTo​(@NonNull
                             FLEncoder enc)
        encodeTo(FlEncoder) is internal method. Please don't use this method.
        Specified by:
        encodeTo in interface FLEncodable
      • equals

        public boolean equals​(@Nullable
                              Object o)
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object