Returns the value for the key. If the key is absent, computes the value using the supplier function, stores it in the map, and returns it.
this method modifies the original map when the key is absent.
Example:
var cache = new HashMap<string, string> (GLib.str_hash, GLib.str_equal);
var val = Maps.computeIfAbsentString (cache, "key", () => {
return "computed";
});
// val == "computed", cache["key"] == "computed"
| map |
the map to query and potentially update. |
| key |
the key to look up. |
| fn |
the supplier function to compute the value if absent. |
|
the existing or newly computed value. |