LazyValueMap (Groovy 5.0.0)

Package: org.apache.groovy.json.internal

## [Java] Class LazyValueMap

- org.apache.groovy.json.internal.LazyValueMap

- All Implemented Interfaces and Traits:
    ValueMap

      public class LazyValueMap
      extends AbstractMap
      implements ValueMap

  This class is important to the performance of the parser. It stores Value objects in a map where they are evaluated lazily. This is great for JSONPath types of application, and Object Serialization but not for maps that are going to be stored in a cache.

  This is because the Value construct is a type of index overlay that merely tracks where the token is located in the buffer, and what if any thing we noted about it (like can be converted to a decimal number, etc.).

  To mitigate memory leaks this class along with CharSequenceValue implement two constructs, namely, chop, and lazyChop.

  A chop is when we convert backing buffer of a Value object into a smaller buffer. A lazyChop is when we do a chop but only when a get operation is called.

  The lazyChop is performed on the tree that is touched by the JSONPath expression or its ilk.

  The chop operation can be done during parsing or lazily by storing the values in this construct.

- - ### Constructor Summary

    Constructors
    Constructor and description
    `LazyValueMap(boolean lazyChop)`
    `LazyValueMap(boolean lazyChop, int initialSize)`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public final void` | `add(MapItemValue miv)` Adds a new MapItemValue to the mapping.
    `` | `public final void` | `chopMap()` Chop this map.
    `` | `public Set<Entry<String, Object>>` | `entrySet()`
    `` | `public final Object` | `get(Object key)` Gets the item by key from the mapping.
    `` | `public boolean` | `hydrated()`
    `` | `public Entry<String, Value>[]` | `items()`
    `` | `public int` | `len()`
    `` | `public Value` | `put(String key, Object value)`
    `` | `public int` | `size()`
    `` | `public String` | `toString()`
    `` | `public Collection<Object>` | `values()`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class AbstractMap` | `clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getClass, getOrDefault, hashCode, isEmpty, keySet, merge, notify, notifyAll, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, toString, values, wait, wait, wait`

- - ### Constructor Detail

    - #### @SuppressWarnings("unchecked")
      public LazyValueMap(boolean lazyChop)

    - #### @SuppressWarnings("unchecked")
      public LazyValueMap(boolean lazyChop, int initialSize)

  - ### Method Detail

    - #### @Override
      public final void add(MapItemValue miv)

      Adds a new MapItemValue to the mapping.

      Parameters:
        `miv` - miv we are adding.

    - #### public final void chopMap()

      Chop this map.

    - #### @Override
      public Set<Entry<String, Object>> entrySet()

    - #### @Override
      public final Object get(Object key)

      Gets the item by key from the mapping.

      Parameters:
        `key` - to lookup
      Returns:
        the item for the given key

    - #### @Override
      public boolean hydrated()

    - #### @Override
      public Entry<String, Value>[] items()

    - #### @Override
      public int len()

    - #### @Override
      public Value put(String key, Object value)

    - #### @Override
      public int size()

    - #### @Override
      public String toString()

    - #### @Override
      public Collection<Object> values()