Package: groovy.lang

## [Java] Class SpreadMap

- groovy.lang.SpreadMap

-     public class SpreadMap
      extends HashMap

  Helper to turn a list with an even number of elements into a Map.

- - ### Constructor Summary

    Constructors
    Constructor and description
    `SpreadMap(Object[] values)` Creates an immutable spread map from alternating key/value entries.
    `SpreadMap(Map map)` Creates an immutable spread map from an existing map.
    `SpreadMap(List list)` Since: 1.8.0

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public boolean` | `equals(Object that)` {@inheritDoc}
    `` | `public boolean` | `equals(SpreadMap that)` Compares this spread map with another spread map using Groovy equality.
    `` | `public int` | `hashCode()` {@inheritDoc}
    `` | `public Object` | `put(Object key, Object value)` Always throws because spread maps are immutable.
    `` | `public void` | `putAll(Map t)` Always throws because spread maps are immutable.
    `` | `public Object` | `remove(Object key)` Always throws because spread maps are immutable.
    `` | `public String` | `toString()` Returns: the string expression of `this`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class HashMap` | `clear, clone, 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

    - #### public SpreadMap(Object[] values)

      Creates an immutable spread map from alternating key/value entries.

      Parameters:
        `values` - alternating keys and values

    - #### public SpreadMap(Map map)

      Creates an immutable spread map from an existing map.

      Parameters:
        `map` - the source map

    - #### public SpreadMap(List list)

      Since:
        1.8.0
      Parameters:
        `list` - the list to make spreadable

  - ### Method Detail

    - #### public boolean equals(Object that)

      {@inheritDoc}

    - #### public boolean equals(SpreadMap that)

      Compares this spread map with another spread map using Groovy equality.

      Parameters:
        `that` - the other spread map
      Returns:
        `true` if the maps are equal

    - #### public int hashCode()

      {@inheritDoc}

    - #### public Object put(Object key, Object value)

      Always throws because spread maps are immutable.

      Parameters:
        `key` - the key to add
        `value` - the value to add
      Returns:
        never returns normally

    - #### public void putAll(Map t)

      Always throws because spread maps are immutable.

      Parameters:
        `t` - the entries to add

    - #### public Object remove(Object key)

      Always throws because spread maps are immutable.

      Parameters:
        `key` - the key to remove
      Returns:
        never returns normally

    - #### public String toString()

      Returns:
        the string expression of `this`