コード例 #1
0
ファイル: ArrayList.php プロジェクト: robo47/BlazeFramework
 /**
  * @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();
     }
 }
コード例 #2
0
 /**
  * {@inheritDoc}
  * @return \blaze\lang\String
  */
 public function toString()
 {
     return $this->array->toString();
 }