HH\Lib\Keyset\intersect
Requires the Hack Standard Library to be installed.
Facebook Engineer?
This function is available as Keyset\intersect()
in Facebook's www repository.
Returns a new keyset containing only the elements of the first Traversable that appear in all the other ones
namespace HH\Lib\Keyset;
function intersect<Tv as arraykey>(
Traversable<Tv> $first,
Traversable<Tv> $second,
Container<Tv> ...$rest,
): keyset<Tv>;
Time complexity: O(n + m), where n is size of $first
and m is the combined
size of $second
plus all the ...$rest
Space complexity: O(n), where n is size of $first
Parameters
Returns
keyset<Tv>