Logo

Programming-Idioms

History of Idiom 172 > diff from v22 to v23

Edit summary for version 23 by andyjduncan:
New Groovy implementation by user [andyjduncan]

Version 22

2020-07-15, 15:47:54

Version 23

2020-10-10, 12:17:58

Idiom #172 Insert entry in map

Insert value v for key k in map m.

Idiom #172 Insert entry in map

Insert value v for key k in map m.

Variables
v,k,m
Variables
v,k,m
Extra Keywords
associative
Extra Keywords
associative
Code
m.k = v
Comments bubble
Uses property notation. Note: this uses the literal string value k as the key.
Doc URL
https://groovy-lang.org/groovy-dev-kit.html#_map_property_notation
Demo URL
https://groovyconsole.appspot.com/script/5172056584880128