public class

JsonList

extends Object
implements JsonSerializable Iterable<T>
java.lang.Object
   ↳ com.urbanairship.json.JsonList

Class Overview

An immutable list of JsonValues.

Summary

Fields
public static final JsonList EMPTY_LIST Empty list.
Public Constructors
JsonList(List<JsonValue> list)
Default Constructor.
Public Methods
boolean contains(JsonValue jsonValue)
Tests whether this List contains the specified JSON value.
boolean equals(Object object)
JsonValue get(int location)
Returns the element at the specified location in this List.
List<JsonValue> getList()
Gets the JsonList as a List.
int hashCode()
int indexOf(JsonValue jsonValue)
Searches this List for the specified object and returns the index of the first occurrence.
boolean isEmpty()
Returns whether this List contains no elements.
Iterator<JsonValue> iterator()
Returns an iterator on the elements of this List.
int lastIndexOf(JsonValue jsonValue)
Searches this List for the specified object and returns the index of the first occurrence.
int size()
Returns the number of elements in this List.
JsonValue toJsonValue()
Returns the objects represented as a JsonValue.
String toString()
Returns the JsonList as a JSON encoded String.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.urbanairship.json.JsonSerializable
From interface java.lang.Iterable

Fields

public static final JsonList EMPTY_LIST

Empty list.

Public Constructors

public JsonList (List<JsonValue> list)

Default Constructor.

Parameters
list A list of JsonValues.

Public Methods

public boolean contains (JsonValue jsonValue)

Tests whether this List contains the specified JSON value.

Parameters
jsonValue the object to search for.
Returns
  • true if the list contains the value, otherwise false.

public boolean equals (Object object)

public JsonValue get (int location)

Returns the element at the specified location in this List.

Parameters
location the index of the element to return.
Returns
  • the element at the specified location.
Throws
IndexOutOfBoundsException if location < 0 || location >= size()

public List<JsonValue> getList ()

Gets the JsonList as a List.

Returns
  • The JsonList as a list.

public int hashCode ()

public int indexOf (JsonValue jsonValue)

Searches this List for the specified object and returns the index of the first occurrence.

Parameters
jsonValue the object to search for.
Returns
  • the index of the first occurrence of the object or -1 if the object was not found.

public boolean isEmpty ()

Returns whether this List contains no elements.

Returns
  • true if this List has no elements, false otherwise.
See Also

public Iterator<JsonValue> iterator ()

Returns an iterator on the elements of this List. The elements are iterated in the same order as they occur in the List.

Returns
  • an iterator on the elements of this List.
See Also

public int lastIndexOf (JsonValue jsonValue)

Searches this List for the specified object and returns the index of the first occurrence.

Parameters
jsonValue the object to search for.
Returns
  • the index of the first occurrence of the object or -1 if the object was not found.

public int size ()

Returns the number of elements in this List.

Returns
  • the number of elements in this List.

public JsonValue toJsonValue ()

Returns the objects represented as a JsonValue.

Returns
  • The object as a JsonValue.

public String toString ()

Returns the JsonList as a JSON encoded String.

Returns
  • The value as a JSON encoded String.