public function each(\Closure $closure): self
    {
        // init
        $array = [];

        foreach ($this->getGenerator() as $key => $value) {
            $array[$key] = $closure($value, $key);
        }

        return static::create(
            $array,
            $this->iteratorClass,
            false
        );
    }
public function each(\Closure $closure): self
    {
        // init
        $array = [];

        foreach ($this->getGenerator() as $key => $value) {
            $array[$key] = $closure($value, $key);
        }

        return static::create(
            $array,
            $this->iteratorClass,
            false
        );
    }
public function each ( \ Closure $ closure ) : self { // init $ array = [ ] ; foreach ( $ this -> getGenerator ( ) as $ key => $ value ) { $ array [ $ key ] = $ closure ( $ value , $ key ) ; } return static :: create ( $ array , $ this -> iteratorClass , false ) ; }
Iterate over the current array and modify the array's value.

@param \Closure $closure

@return static
<p>(Immutable)</p>
Iterate over the current array and modify the array s value .