HH\Lib\Dict\diff_by_key

Meta Engineer?

This is available as Dict\diff_by_key in the www repository.

Returns a new dict containing only the entries of the first KeyedTraversable whose keys do not appear in any of the other ones

namespace HH\Lib\Dict;

function diff_by_key<Tk1 as arraykey, Tk2 as arraykey, Tv>(
  KeyedTraversable<Tk1, Tv> $first,
  KeyedTraversable<Tk2, mixed> $second,
  KeyedContainer<Tk2, mixed> ...$rest,
): dict<Tk1, 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 + m), where n is size of $first and m is the combined size of $second plus all the ...$rest -- note that this is bigger than O(n)

Parameters

Returns

  • dict<Tk1, Tv>