This language bar is your friend. Select your favorite languages!

Idiom #172 Insert entry in map

Insert value v for key k in map m.

use std::collection::HashMap;
let mut map = HashMap::new();
map.put(K,V);
m[k] = v;
m[k] = v
$m[$k] = $v;
fgl
m.KeyData[k] := v;
m[k] = v
m[k] = v

Do you know the best way to do this in your language ?
New implementation...

Idiom created by

programming-idioms

Related idioms