EZ JSON
by Nathanaël Cottin

org.ezjson
Class JSONArray

java.lang.Object
  extended by org.ezjson.JSONArray
All Implemented Interfaces:
java.lang.Iterable<JSONValue>, JSONValue

public final class JSONArray
extends java.lang.Object
implements JSONValue, java.lang.Iterable<JSONValue>

A JSON array is able to hold an ordered collection of JSON values, independently from their actual type. This means that, according to the JSON specification, an array can mix different JSON types.
Note that this array is iterable: each internal JSON value can be accessed using a foreach construct

Author:
ncottin

Constructor Summary
JSONArray()
          Creates an empty JSON array
 
Method Summary
 void add(JSONValue value)
          Ensures that this JSON array contains the specified value
 java.util.Collection<JSONValue> getValues()
          Gets the current collection of values this array holds
 java.util.Iterator<JSONValue> iterator()
           
 int size()
          Gets the size of this array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSONArray

public JSONArray()
Creates an empty JSON array

Method Detail

size

public int size()
Gets the size of this array. The initial size is 0

Returns:
The number of elements of this array

getValues

public java.util.Collection<JSONValue> getValues()
Gets the current collection of values this array holds

Returns:
The internal collection of values

add

public void add(JSONValue value)
Ensures that this JSON array contains the specified value

Parameters:
value - A possibly null value to add to the current collection

iterator

public java.util.Iterator<JSONValue> iterator()
Specified by:
iterator in interface java.lang.Iterable<JSONValue>

EZ JSON
by Nathanaël Cottin