public function filter(callable $func) : self
    {
        $list = $this->list;
        $acc = [];

        foreach ($list as $index => $val) {
            if ($func($val)) {
                $acc[] = $val;
            }
        }

        return new static(\SplFixedArray::fromArray($acc));
    }
public function filter(callable $func) : self
    {
        $list = $this->list;
        $acc = [];

        foreach ($list as $index => $val) {
            if ($func($val)) {
                $acc[] = $val;
            }
        }

        return new static(\SplFixedArray::fromArray($acc));
    }
public function filter ( callable $ func ) : self { $ list = $ this -> list ; $ acc = [ ] ; foreach ( $ list as $ index => $ val ) { if ( $ func ( $ val ) ) { $ acc [ ] = $ val ; } } return new static ( \ SplFixedArray :: fromArray ( $ acc ) ) ; }
filter method.

@method filter

@param callable $func

@return object Collection
filter method .