public function flatten() { $result = new self(); foreach ($this->flattenGen() as $value) { $result->pushToEnd($value); } return $result; }