getOrDefaultString


Description:

public static string getOrDefaultString (HashMap<string,string> map, string key, string defaultValue)

Returns the value for the key, or the default value if the key is not found.

Example:

    var map = new HashMap<string, string> (GLib.str_hash, GLib.str_equal);
map.put ("host", "localhost");
var host = Maps.getOrDefaultString (map, "host", "0.0.0.0");
var port = Maps.getOrDefaultString (map, "port", "8080");
// host == "localhost", port == "8080"

Parameters:

map

the source map.

key

the key to look up.

defaultValue

the value to return if key is absent.

Returns:

the value for the key, or defaultValue.