HH\Lib\Dict\associate
Requires the Hack Standard Library to be installed.
Facebook Engineer?
This function is available as Dict\associate()
in Facebook's www repository.
Returns a new dict where each element in $keys
maps to the
corresponding element in $values
namespace HH\Lib\Dict;
function associate<Tk as arraykey, Tv>(
Traversable<Tk> $keys,
Traversable<Tv> $values,
): dict<Tk, Tv>;
Time complexity: O(n) where n is the size of $keys
(which must be the same
as the size of $values
)
Space complexity: O(n) where n is the size of $keys
(which must be the same
as the size of $values
)
Parameters
Returns
dict<Tk, Tv>