/** * @param \blaze\collections\Collection|\blaze\collections\ArrayI|array $collectionOrArray */ public function __construct($collectionOrArray = null) { if ($collectionOrArray !== null) { if ($collectionOrArray instanceof blaze\collections\Collection) { $this->elementData = $collectionOrArray->toArray(); $this->size = count($this->elementData); } else { if ($collectionOrArray instanceof \blaze\collections\ArrayI || is_array($collectionOrArray)) { $this->size = count($collectionOrArray); $this->elementData = array(); foreach ($collectionOrArray as $elem) { $this->elementData[] = $elem; } } else { throw new \blaze\lang\IllegalArgumentException('Invalid type for parameter'); } } } else { $this->size = 0; $this->elementData = array(); } }
/** * {@inheritDoc} * @return \blaze\lang\String */ public function toString() { return $this->array->toString(); }