public function filter(callable $function): Dict
    {
        $result = new Dict();

        foreach ($this->data as $key => $value) {
            if (!!$function($key, $value)) {
                $result->offsetSet($key, $value);
            }
        }

        return $result;
    }