com.google.gwt.json.client

## Class JSONArray

- java.lang.Object
- - com.google.gwt.json.client.JSONValue
  - - com.google.gwt.json.client.JSONArray

-     public class JSONArray
      extends JSONValue

  Represents an array of `JSONValue` objects.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JSONArray()` Creates an empty JSONArray.
    `JSONArray(JavaScriptObject arr)` Creates a new JSONArray from the supplied JavaScriptObject representing a JavaScript array.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object other)` Returns `true` if `other` is a `JSONArray` wrapping the same underlying object.
    `JSONValue` | `get(int index)` Returns the value at the specified index position.
    `JavaScriptObject` | `getJavaScriptObject()` Returns the underlying JavaScript array that this object wraps.
    `(package private) JavaScriptObject` | `getUnwrapper()` Internal.
    `int` | `hashCode()`
    `JSONArray` | `isArray()` Returns `this`, as this is a JSONArray.
    `JSONValue` | `set(int index, JSONValue value)` Sets the specified index to the given value.
    `int` | `size()` Returns the number of elements in this array.
    `java.lang.String` | `toString()` Create the JSON encoded string representation of this JSONArray instance.

    - ### Methods inherited from class com.google.gwt.json.client.JSONValue

      `isBoolean, isNull, isNumber, isObject, isString`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### JSONArray

          public JSONArray()

      Creates an empty JSONArray.

    - #### JSONArray

          public JSONArray(JavaScriptObject arr)

      Creates a new JSONArray from the supplied JavaScriptObject representing a JavaScript array.
      Parameters:
        `arr` - a JavaScript array

  - ### Method Detail

    - #### equals

          public boolean equals(java.lang.Object other)

      Returns `true` if `other` is a `JSONArray` wrapping the same underlying object.
      Overrides:
        `equals` in class `java.lang.Object`

    - #### get

          public JSONValue get(int index)

      Returns the value at the specified index position.
      Parameters:
        `index` - the index of the array item to retrieve
      Returns:
        the value at this index, or `null` if this index is empty

    - #### getJavaScriptObject

          public JavaScriptObject getJavaScriptObject()

      Returns the underlying JavaScript array that this object wraps.

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### isArray

          public JSONArray isArray()

      Returns `this`, as this is a JSONArray.
      Overrides:
        `isArray` in class `JSONValue`
      Returns:
        a reference to a JSONArray if this JSONValue is a JSONArray or `null` otherwise.

    - #### set

          public JSONValue set(int index,
                               JSONValue value)

      Sets the specified index to the given value.
      Parameters:
        `index` - the index to set
        `value` - the value to set
      Returns:
        the previous value at this index, or `null` if this index was empty

    - #### size

          public int size()

      Returns the number of elements in this array.
      Returns:
        size of this array

    - #### toString

          public java.lang.String toString()

      Create the JSON encoded string representation of this JSONArray instance. This method may take a long time to execute if the underlying array is large.
      Specified by:
        `toString` in class `JSONValue`

    - #### getUnwrapper

          JavaScriptObject getUnwrapper()

      Description copied from class: `JSONValue`
      Internal. Returns a JS func that can unwrap this value. Used from native code.
      Specified by:
        `getUnwrapper` in class `JSONValue`