Package groovy.lang
Class SpreadMap
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap
groovy.lang.SpreadMap
- All Implemented Interfaces:
Serializable,Cloneable,Map
Helper to turn a list with an even number of elements into a Map.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanCompares this spread map with another spread map using Groovy equality.booleaninthashCode()Always throws because spread maps are immutable.voidAlways throws because spread maps are immutable.Always throws because spread maps are immutable.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
-
Constructor Details
-
SpreadMap
Creates an immutable spread map from alternating key/value entries.- Parameters:
values- alternating keys and values
-
SpreadMap
Creates an immutable spread map from an existing map.- Parameters:
map- the source map
-
SpreadMap
- Parameters:
list- the list to make spreadable- Since:
- 1.8.0
-
-
Method Details
-
put
Always throws because spread maps are immutable. -
remove
Always throws because spread maps are immutable. -
putAll
Always throws because spread maps are immutable. -
equals
- Specified by:
equalsin interfaceMap- Overrides:
equalsin classAbstractMap
-
equals
Compares this spread map with another spread map using Groovy equality.- Parameters:
that- the other spread map- Returns:
trueif the maps are equal
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceMap- Overrides:
hashCodein classAbstractMap
-
toString
- Overrides:
toStringin classAbstractMap- Returns:
- the string expression of
this
-