<div dir="ltr"><div><div>Hello,<br><br>Having a map where the value of each element it's a list :<br><br>#{ 1 => [], 2 => [], ... n => []} <br><br>and you need to append elements in the list for a specific key, what's the most optimal way to do this without copying the lists and the map inside the VM lot of times ?<br><br>Anything better than the following solution:<br><br>append_element(Key, Value, Map) -><br>    case maps:find(Key, Map) of<br>        {ok, V} -><br>            maps:put(Key, [Value | V], Map);<br>        _ -><br>            maps:put(Key, [Value], Map)<br>    end.<br><br></div>Kind regards,<br></div>Silviu<br></div>