getOrDefault


Description:

public V getOrDefault (K key, V defaultValue)

Returns the value associated with the specified key, or the default value if the key is not found.

Example:

    var map = new HashMap<string,string> (GLib.str_hash, GLib.str_equal);
assert (map.getOrDefault ("missing", "fallback") == "fallback");

Parameters:

key

the key to look up.

defaultValue

the value to return if the key is not found.

Returns:

the associated value, or defaultValue if not found.