Collections\Dictionary::filter PHP Method

filter() public method

public filter ( callable $condition )
$condition callable
    public function filter(callable $condition)
    {
        $storage = [];
        foreach ($this->storage as $key => $value) {
            if ($condition($key, $value)) {
                $storage[$key] = $value;
            }
        }
        return new static($this->keyType, $this->valType, $storage);
    }