Package groovy.lang

Class SpreadMap

java.lang.Object
java.util.AbstractMap<K,​V>
java.util.HashMap
groovy.lang.SpreadMap
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map

public class SpreadMap
extends java.util.HashMap
Helper to turn a list with an even number of elements into a Map.
See Also:
Serialized Form
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.util.AbstractMap

    java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>

    Nested classes/interfaces inherited from interface java.util.Map

    java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
  • Constructor Summary

    Constructors
    Constructor Description
    SpreadMap​(java.lang.Object[] values)  
    SpreadMap​(java.util.List list)  
    SpreadMap​(java.util.Map map)  
  • Method Summary

    Modifier and Type Method Description
    boolean equals​(SpreadMap that)  
    boolean equals​(java.lang.Object that)  
    int hashCode()  
    java.lang.Object put​(java.lang.Object key, java.lang.Object value)  
    void putAll​(java.util.Map t)  
    java.lang.Object remove​(java.lang.Object key)  
    java.lang.String toString()  

    Methods inherited from class java.util.HashMap

    clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, putIfAbsent, remove, replace, replace, replaceAll, size, values

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SpreadMap

      public SpreadMap​(java.lang.Object[] values)
    • SpreadMap

      public SpreadMap​(java.util.Map map)
    • SpreadMap

      public SpreadMap​(java.util.List list)
      Parameters:
      list - the list to make spreadable
      Since:
      1.8.0
  • Method Details

    • put

      public java.lang.Object put​(java.lang.Object key, java.lang.Object value)
      Specified by:
      put in interface java.util.Map
      Overrides:
      put in class java.util.HashMap
    • remove

      public java.lang.Object remove​(java.lang.Object key)
      Specified by:
      remove in interface java.util.Map
      Overrides:
      remove in class java.util.HashMap
    • putAll

      public void putAll​(java.util.Map t)
      Specified by:
      putAll in interface java.util.Map
      Overrides:
      putAll in class java.util.HashMap
    • equals

      public boolean equals​(java.lang.Object that)
      Specified by:
      equals in interface java.util.Map
      Overrides:
      equals in class java.util.AbstractMap
    • equals

      public boolean equals​(SpreadMap that)
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface java.util.Map
      Overrides:
      hashCode in class java.util.AbstractMap
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.util.AbstractMap
      Returns:
      the string expression of this