code: public function toArray() : array
      {
          $res = [];
          Iterators::each($this->iterator(), function ($element) use (&$res) {
              $res[] = $element;
          });
          return $res;
      }
docs: Converts this object to an array. This means it will iterate over this object.
  It should be used only if it is reasonable.
  
  @return array