Extensions to the base Object class.
| Type Params | Return Type | Name and description |
|---|---|---|
<T> |
static T |
getOrCreate(Object self, String key, Closure<T> create)Retrieves a value from any object that supports the subscript operators (square bracket notation, implemented by the getAt/putAt
methods). |
Retrieves a value from any object that supports the subscript operators
(square bracket notation, implemented by the getAt/putAt
methods). If there is no value for the given key, then the create
closure is executed and its return value is set on the object for the key,
and returned to the calling code.
key.