HH\Lib\Dict\fill_keys

Requires the Hack Standard Library to be installed.
Facebook Engineer?

This function is available as Dict\fill_keys() in Facebook's www repository.

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

Returns

  • dict<Tk, Tv>