Interface JsonArray

All Superinterfaces:
JsonValue
All Known Implementing Classes:
JsonArrayImpl

public interface JsonArray extends JsonValue
Json array instance.
Author:
antons
  • Method Details

    • isEmpty

      boolean isEmpty()
      Checks if this json array contains no value.
      Returns:
      true if json array is empty.
    • size

      int size()
      Size of json array.
      Returns:
      size of json array.
    • clear

      void clear()
      Clears content of json array.
    • get

      JsonValue get(int index)
      Reads n'th item from json array.
      Parameters:
      index - order if returned item (first element has index=0)
      Returns:
      element of json array at 'index' position
    • first

      JsonValue first()
      Reads first element of json array.
      Returns:
      first element of json array or null if array is empty.
    • last

      JsonValue last()
      Reads last element of json array.
      Returns:
      last element of json array or null if array is empty.
    • remove

      JsonValue remove(int index)
      Removes n'th element from json array.
      Parameters:
      index - position of element in json array which should be removed
      Returns:
      removed element
    • add

      JsonArray add(JsonValue value)
      Adds new element to json array.
      Parameters:
      value - value to be added to the array. Should not be empty
      Returns:
      this json array instance
    • add

      JsonArray add(JsonValue value, int index)
      Adds new element to json array at specified position.
      Parameters:
      value - value to be added to the array. Should not be empty
      index - position where value should be added;
      Returns:
      this json array instance
    • toList

      List<JsonValue> toList()
      Converts this instance to regulat list of values.
      Returns:
      list of json array values.