mapKeysString


Description:

public static HashMap<string,string> mapKeysString (HashMap<string,string> map, owned MapFunc<string,string> fn, owned ConflictResolverFunc<string>? on_conflict = null)

Returns a new map with all keys transformed by the function. Values are preserved. If multiple keys map to the same new key, later entries overwrite earlier ones unless conflict resolver is provided.

Example:

    var map = new HashMap<string, string> (GLib.str_hash, GLib.str_equal);
map.put ("Name", "Alice");
var lower = Maps.mapKeysString (map, (k) => { return k.down (); });
// lower["name"] == "Alice"

Parameters:

map

the source map.

fn

the key transformation function.

on_conflict

optional resolver for key collisions.

Returns:

a new HashMap with transformed keys.