HH\Lib\Dict\fill_keys
Returns a new dict where all the given keys map to the given value
namespace HH\Lib\Dict;
function fill_keys<Tk as arraykey, Tv>(
Traversable<Tk> $keys,
Tv $value,
): dict<Tk, Tv>;
Time complexity: O(n) Space complexity: O(n)
Parameters
Traversable<Tk>
$keys
Tv $value
Returns
dict<Tk, Tv>
Examples
$keys = vec['k1', 'k2', 'k3', 'k4'];
$value = 5;
$dict = Dict\fill_keys($keys, $value);
\print_r($dict);