Associates the value with the key only if the key is not already present. Returns true if the value was added.
Example:
var map = new HashMap<string,string> (GLib.str_hash, GLib.str_equal);
assert (map.putIfAbsent ("key", "first"));
assert (!map.putIfAbsent ("key", "second"));
assert (map.get ("key") == "first");
| key |
the key. |
| value |
the value to set if key is absent. |
|
true if the value was added. |