Package: groovy.json.internal

## [Java] Class LazyValueMap

- groovy.json.internal.LazyValueMap

- All Implemented Interfaces and Traits:
    ValueMap

      public class LazyValueMap
      extends AbstractMap

  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.
  Authors:
    Rick Hightower (insane chipmonk)

- - ### Constructor Summary

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

  - ### Methods Summary

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

  - ### Inherited Methods Summary

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

- - ### Constructor Detail

    - #### public LazyValueMap(boolean lazyChop)

    - #### public LazyValueMap(boolean lazyChop, int initialSize)

  - ### Method Detail

    - #### 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.

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

    - #### 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

    - #### 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()