Package org.apache.groovy.json.internal

# Class ValueList

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<Object>
org.apache.groovy.json.internal.ValueList

All Implemented Interfaces:
  `Iterable<Object>`, `Collection<Object>`, `List<Object>`

public class ValueList extends AbstractList<Object>
List implementation that lazily converts overlay `Value` instances on access.

- ## Field Summary

  ### Fields inherited from class java.util.AbstractList

  `modCount`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ValueList(boolean lazyChop)`
  Creates a lazy list wrapper.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `add(Object obj)`
  Adds a parsed element without forcing conversion.
  `void`
  `chopList()`
  Chops every overlay-backed element currently stored in the list.
  `void`
  `clear()`
  `Object`
  `get(int index)`
  Converts the indexed element on demand and optionally chops nested containers.
  `Iterator<Object>`
  `iterator()`
  Returns an iterator after materializing all pending `Value` entries.
  `List<Object>`
  `list()`
  Exposes the raw backing list used during lazy parsing.
  `int`
  `size()`

  ### Methods inherited from class java.util.AbstractList

  `add, addAll, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList`

  ### Methods inherited from class java.util.AbstractCollection

  `addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString`

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

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

  ### Methods inherited from interface java.util.Collection

  `parallelStream, removeIf, stream, toArray`

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

  `forEach`

  ### Methods inherited from interface java.util.List

  `addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray`

- ## Constructor Details

  - ### ValueList

    public ValueList(boolean lazyChop)
    Creates a lazy list wrapper.
    Parameters:
      `lazyChop` - whether nested values should be chopped when touched

- ## Method Details

  - ### get

    public Object get(int index)
    Converts the indexed element on demand and optionally chops nested containers.
    Specified by:
      `get` in interface `List<Object>`
    Specified by:
      `get` in class `AbstractList<Object>`
    Parameters:
      `index` - element index
    Returns:
      the materialized element

  - ### size

    public int size()
    Specified by:
      `size` in interface `Collection<Object>`
    Specified by:
      `size` in interface `List<Object>`
    Specified by:
      `size` in class `AbstractCollection<Object>`

  - ### iterator

    public Iterator<Object> iterator()
    Returns an iterator after materializing all pending `Value` entries.
    Specified by:
      `iterator` in interface `Collection<Object>`
    Specified by:
      `iterator` in interface `Iterable<Object>`
    Specified by:
      `iterator` in interface `List<Object>`
    Overrides:
      `iterator` in class `AbstractList<Object>`
    Returns:
      iterator over hydrated elements

  - ### clear

    public void clear()
    Specified by:
      `clear` in interface `Collection<Object>`
    Specified by:
      `clear` in interface `List<Object>`
    Overrides:
      `clear` in class `AbstractList<Object>`

  - ### add

    public boolean add(Object obj)
    Adds a parsed element without forcing conversion.
    Specified by:
      `add` in interface `Collection<Object>`
    Specified by:
      `add` in interface `List<Object>`
    Overrides:
      `add` in class `AbstractList<Object>`
    Parameters:
      `obj` - element to append
    Returns:
      `true`

  - ### chopList

    public void chopList()
    Chops every overlay-backed element currently stored in the list.

  - ### list

    public List<Object> list()
    Exposes the raw backing list used during lazy parsing.
    Returns:
      the mutable backing list