public function filter($matcher) {
        $filtered = array();
        foreach ($this as $key => $element) {
            if (call_user_func($matcher, $element, $key)) {
                $filtered[$key] = $element;
            }
        }

        return new static($filtered);
    }