Package oracle.nosql.driver.values

# Class ArrayValue

java.lang.Object
oracle.nosql.driver.values.FieldValue
oracle.nosql.driver.values.ArrayValue

All Implemented Interfaces:
  `Comparable<FieldValue>`, `Iterable<FieldValue>`

public class ArrayValue extends FieldValue implements Iterable<FieldValue>
ArrayValue represents an array of `FieldValue` instances. It behaves in a similar manner to `ArrayList` with operations to set and add entries. ArrayValue indexes are zero-based.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class oracle.nosql.driver.values.FieldValue

  `FieldValue.Type`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ArrayValue()`
  Creates an empty ArrayValue
  `ArrayValue(int size)`
  Creates an empty ArrayValue with the specified size

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ArrayValue`
  `add(boolean value)`
  Adds a new value at the end of the array
  `ArrayValue`
  `add(byte[] value)`
  Adds a new value at the end of the array
  `ArrayValue`
  `add(double value)`
  Adds a new value at the end of the array
  `ArrayValue`
  `add(int value)`
  Adds a new value at the end of the array
  `ArrayValue`
  `add(int index, boolean value)`
  Inserts a new value at the specified index.
  `ArrayValue`
  `add(int index, byte[] value)`
  Inserts a new value at the specified index.
  `ArrayValue`
  `add(int index, double value)`
  Inserts a new value at the specified index.
  `ArrayValue`
  `add(int index, int value)`
  Inserts a new value at the specified index.
  `ArrayValue`
  `add(int index, long value)`
  Inserts a new value at the specified index.
  `ArrayValue`
  `add(int index, String value)`
  Inserts a new value at the specified index.
  `ArrayValue`
  `add(int index, BigDecimal value)`
  Inserts a new value at the specified index.
  `ArrayValue`
  `add(int index, FieldValue value)`
  Inserts the field at the specified index.
  `ArrayValue`
  `add(long value)`
  Adds a new value at the end of the array
  `ArrayValue`
  `add(String value)`
  Adds a new value at the end of the array
  `ArrayValue`
  `add(BigDecimal value)`
  Adds a new value at the end of the array
  `ArrayValue`
  `add(FieldValue value)`
  Adds the field to the end of the array
  `ArrayValue`
  `addAll(int index, Iterator<? extends FieldValue> iter)`
  Inserts all of the elements in the specified Iterator into the array, starting at the specified position.
  `ArrayValue`
  `addAll(int index, Stream<? extends FieldValue> stream)`
  Inserts all of the elements in the specified Stream into the array, starting at the specified position.
  `ArrayValue`
  `addAll(Iterator<? extends FieldValue> iter)`
  Adds all of the values in the Iterator to the end of the array in the order they are returned by the iterator.
  `ArrayValue`
  `addAll(Stream<? extends FieldValue> stream)`
  Adds all of the values in the Stream to the end of the array in the order they are returned by the stream.
  `int`
  `compareTo(FieldValue other)`
  `boolean`
  `equals(Object other)`
  `FieldValue`
  `get(int index)`
  Returns the field at the specified index.
  `FieldValue.Type`
  `getType()`
  Returns the type of the object
  `FieldValue.Type`
  `getType(int index)`
  Returns the type of the field at the specified index.
  `int`
  `hashCode()`
  `Iterator<FieldValue>`
  `iterator()`
  `FieldValue`
  `remove(int index)`
  Removes the element at the specified position, shifting any subsequent elements to the left.
  `FieldValue`
  `set(int index, boolean value)`
  Replaces the element at the specified position with the new value.
  `FieldValue`
  `set(int index, byte[] value)`
  Replaces the element at the specified position with the new value.
  `FieldValue`
  `set(int index, double value)`
  Replaces the element at the specified position with the new value.
  `FieldValue`
  `set(int index, int value)`
  Replaces the element at the specified position with the new value.
  `FieldValue`
  `set(int index, long value)`
  Replaces the element at the specified position with the new value.
  `FieldValue`
  `set(int index, String value)`
  Replaces the element at the specified position with the new value.
  `FieldValue`
  `set(int index, BigDecimal value)`
  Replaces the element at the specified position with the new value.
  `FieldValue`
  `set(int index, FieldValue value)`
  Replaces the element at the specified position with the new value.
  `int`
  `size()`
  Returns the size of the array

  ### Methods inherited from class oracle.nosql.driver.values.FieldValue

  `asArray, asBinary, asBoolean, asDouble, asInteger, asJsonNull, asLong, asMap, asNull, asNumber, asString, asTimestamp, castAsDouble, createFromJson, createFromJson, createFromJson, getBinary, getBoolean, getDouble, getInt, getLong, getNumber, getSerializedSize, getString, getTimestamp, isAnyNull, isArray, isAtomic, isBinary, isBoolean, isDouble, isInteger, isJsonNull, isLong, isMap, isNull, isNumber, isNumeric, isString, isTimestamp, toJson, toJson, toString`

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

  `getClass, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface java.lang.Iterable

  `forEach, spliterator`

- ## Constructor Details

  - ### ArrayValue

    public ArrayValue()
    Creates an empty ArrayValue

  - ### ArrayValue

    public ArrayValue(int size)
    Creates an empty ArrayValue with the specified size
    Parameters:
      `size` - the starting size for the array

- ## Method Details

  - ### getType

    public FieldValue.Type getType()
    Description copied from class: `FieldValue`
    Returns the type of the object
    Specified by:
      `getType` in class `FieldValue`
    Returns:
      the type

  - ### size

    public int size()
    Returns the size of the array
    Returns:
      the size

  - ### getType

    public FieldValue.Type getType(int index)
    Returns the type of the field at the specified index.
    Parameters:
      `index` - the index of the value to return, zero-based
    Returns:
      the type of the field at the specified index
    Throws:
      `IndexOutOfBoundsException` - if the index is out of the range of the array.

  - ### get

    public FieldValue get(int index)
    Returns the field at the specified index.
    Parameters:
      `index` - the index of the value to return, zero-based
    Returns:
      the field at the specified index
    Throws:
      `IndexOutOfBoundsException` - if the index is out of the range of the array.

  - ### add

    public ArrayValue add(FieldValue value)
    Adds the field to the end of the array
    Parameters:
      `value` - the value to add
    Returns:
      this

  - ### add

    public ArrayValue add(int index, FieldValue value)
    Inserts the field at the specified index. Shifts the element at that position and any subsequent elements to the right.
    Parameters:
      `index` - the index to use
      `value` - the value to add
    Returns:
      this
    Throws:
      `IndexOutOfBoundsException` - if the index is out of the range of the array.

  - ### set

    public FieldValue set(int index, FieldValue value)
    Replaces the element at the specified position with the new value.
    Parameters:
      `value` - the value to set
      `index` - the index to use
    Returns:
      the element previously at the specified position
    Throws:
      `IndexOutOfBoundsException` - if the index is out of the range of the array.

  - ### remove

    public FieldValue remove(int index)
    Removes the element at the specified position, shifting any subsequent elements to the left.
    Parameters:
      `index` - the index to use
    Returns:
      the element previously at the specified position
    Throws:
      `IndexOutOfBoundsException` - if the index is out of the range of the array.

  - ### addAll

    public ArrayValue addAll(Stream<? extends FieldValue> stream)
    Adds all of the values in the Stream to the end of the array in the order they are returned by the stream.
    Parameters:
      `stream` - the Stream
    Returns:
      this

  - ### addAll

    public ArrayValue addAll(int index, Stream<? extends FieldValue> stream)
    Inserts all of the elements in the specified Stream into the array, starting at the specified position. Shifts the element currently at that position and any subsequent elements to the right (increases their indices). New elements are added in the order that they are returned by the stream.
    Parameters:
      `index` - the index to use
      `stream` - the Stream
    Returns:
      this

  - ### addAll

    public ArrayValue addAll(Iterator<? extends FieldValue> iter)
    Adds all of the values in the Iterator to the end of the array in the order they are returned by the iterator.
    Parameters:
      `iter` - the iterator
    Returns:
      this

  - ### addAll

    public ArrayValue addAll(int index, Iterator<? extends FieldValue> iter)
    Inserts all of the elements in the specified Iterator into the array, starting at the specified position. Shifts the element currently at that position and any subsequent elements to the right (increases their indices). New elements are added in the order that they are returned by the iterator.
    Parameters:
      `index` - the index to use
      `iter` - the iterator
    Returns:
      this
    Throws:
      `IndexOutOfBoundsException` - if the index is out of the range of the array.

  - ### add

    public ArrayValue add(int value)
    Adds a new value at the end of the array
    Parameters:
      `value` - the value to add
    Returns:
      this

  - ### add

    public ArrayValue add(int index, int value)
    Inserts a new value at the specified index. Shifts the element at that position and any subsequent elements to the right.
    Parameters:
      `index` - the index to use
      `value` - the value to add
    Returns:
      this
    Throws:
      `IndexOutOfBoundsException` - if the index is out of the range of the array.

  - ### set

    public FieldValue set(int index, int value)
    Replaces the element at the specified position with the new value.
    Parameters:
      `value` - the value to set
      `index` - the index to use
    Returns:
      the element previously at the specified position
    Throws:
      `IndexOutOfBoundsException` - if the index is out of the range of the array.

  - ### add

    public ArrayValue add(long value)
    Adds a new value at the end of the array
    Parameters:
      `value` - the value to add
    Returns:
      this

  - ### add

    public ArrayValue add(int index, long value)
    Inserts a new value at the specified index. Shifts the element at that position and any subsequent elements to the right.
    Parameters:
      `index` - the index to use
      `value` - the value to add
    Returns:
      this
    Throws:
      `IndexOutOfBoundsException` - if the index is out of the range of the array.

  - ### set

    public FieldValue set(int index, long value)
    Replaces the element at the specified position with the new value.
    Parameters:
      `value` - the value to set
      `index` - the index to use
    Returns:
      the element previously at the specified position
    Throws:
      `IndexOutOfBoundsException` - if the index is out of the range of the array.

  - ### add

    public ArrayValue add(double value)
    Adds a new value at the end of the array
    Parameters:
      `value` - the value to add
    Returns:
      this

  - ### add

    public ArrayValue add(int index, double value)
    Inserts a new value at the specified index. Shifts the element at that position and any subsequent elements to the right.
    Parameters:
      `index` - the index to use
      `value` - the value to add
    Returns:
      this
    Throws:
      `IndexOutOfBoundsException` - if the index is out of the range of the array.

  - ### set

    public FieldValue set(int index, double value)
    Replaces the element at the specified position with the new value.
    Parameters:
      `value` - the value to set
      `index` - the index to use
    Returns:
      the element previously at the specified position
    Throws:
      `IndexOutOfBoundsException` - if the index is out of the range of the array.

  - ### add

    public ArrayValue add(BigDecimal value)
    Adds a new value at the end of the array
    Parameters:
      `value` - the value to add
    Returns:
      this

  - ### add

    public ArrayValue add(int index, BigDecimal value)
    Inserts a new value at the specified index. Shifts the element at that position and any subsequent elements to the right.
    Parameters:
      `index` - the index to use
      `value` - the value to add
    Returns:
      this
    Throws:
      `IndexOutOfBoundsException` - if the index is out of the range of the array.

  - ### set

    public FieldValue set(int index, BigDecimal value)
    Replaces the element at the specified position with the new value.
    Parameters:
      `value` - the value to set
      `index` - the index to use
    Returns:
      the element previously at the specified position
    Throws:
      `IndexOutOfBoundsException` - if the index is out of the range of the array.

  - ### add

    public ArrayValue add(boolean value)
    Adds a new value at the end of the array
    Parameters:
      `value` - the value to add
    Returns:
      this

  - ### add

    public ArrayValue add(int index, boolean value)
    Inserts a new value at the specified index. Shifts the element at that position and any subsequent elements to the right.
    Parameters:
      `index` - the index to use
      `value` - the value to add
    Returns:
      this
    Throws:
      `IndexOutOfBoundsException` - if the index is out of the range of the array.

  - ### set

    public FieldValue set(int index, boolean value)
    Replaces the element at the specified position with the new value.
    Parameters:
      `value` - the value to set
      `index` - the index to use
    Returns:
      the element previously at the specified position
    Throws:
      `IndexOutOfBoundsException` - if the index is out of the range of the array.

  - ### add

    public ArrayValue add(String value)
    Adds a new value at the end of the array
    Parameters:
      `value` - the value to add
    Returns:
      this

  - ### add

    public ArrayValue add(int index, String value)
    Inserts a new value at the specified index. Shifts the element at that position and any subsequent elements to the right.
    Parameters:
      `index` - the index to use
      `value` - the value to add
    Returns:
      this
    Throws:
      `IndexOutOfBoundsException` - if the index is out of the range of the array.

  - ### set

    public FieldValue set(int index, String value)
    Replaces the element at the specified position with the new value.
    Parameters:
      `value` - the value to set
      `index` - the index to use
    Returns:
      the element previously at the specified position
    Throws:
      `IndexOutOfBoundsException` - if the index is out of the range of the array.

  - ### add

    public ArrayValue add(byte[] value)
    Adds a new value at the end of the array
    Parameters:
      `value` - the value to add
    Returns:
      this

  - ### add

    public ArrayValue add(int index, byte[] value)
    Inserts a new value at the specified index. Shifts the element at that position and any subsequent elements to the right.
    Parameters:
      `index` - the index to use
      `value` - the value to add
    Returns:
      this
    Throws:
      `IndexOutOfBoundsException` - if the index is out of the range of the array.

  - ### set

    public FieldValue set(int index, byte[] value)
    Replaces the element at the specified position with the new value.
    Parameters:
      `value` - the value to set
      `index` - the index to use
    Returns:
      the element previously at the specified position
    Throws:
      `IndexOutOfBoundsException` - if the index is out of the range of the array.

  - ### compareTo

    public int compareTo(FieldValue other)
    Specified by:
      `compareTo` in interface `Comparable<FieldValue>`

  - ### iterator

    public Iterator<FieldValue> iterator()
    Specified by:
      `iterator` in interface `Iterable<FieldValue>`

  - ### equals

    public boolean equals(Object other)
    Overrides:
      `equals` in class `Object`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`