| @@ 248-259 (lines=12) @@ | ||
| 245 | * {@inheritDoc} |
|
| 246 | * @return $this |
|
| 247 | */ |
|
| 248 | public function zip($traversable) |
|
| 249 | { |
|
| 250 | if (is_array($traversable)) { |
|
| 251 | $traversable = new ImmVector($traversable); |
|
| 252 | } |
|
| 253 | ||
| 254 | if ($traversable instanceof \Traversable) { |
|
| 255 | return new static(new LazyZipIterable($this, $traversable)); |
|
| 256 | } else { |
|
| 257 | throw new \InvalidArgumentException('Parameter must be an array or an instance of Traversable'); |
|
| 258 | } |
|
| 259 | } |
|
| 260 | ||
| 261 | /** |
|
| 262 | * {@inheritDoc} |
|
| @@ 27-38 (lines=12) @@ | ||
| 24 | /** |
|
| 25 | * {@inheritDoc} |
|
| 26 | */ |
|
| 27 | public function concat($Enumerable) |
|
| 28 | { |
|
| 29 | if (is_array($Enumerable)) { |
|
| 30 | $Enumerable = new ImmVector($Enumerable); |
|
| 31 | } |
|
| 32 | ||
| 33 | if ($Enumerable instanceof \Traversable) { |
|
| 34 | return new ImmVector(new LazyConcatIterator($this, $Enumerable)); |
|
| 35 | } else { |
|
| 36 | throw new \InvalidArgumentException('Parameter must be an array or an instance of Traversable'); |
|
| 37 | } |
|
| 38 | } |
|
| 39 | } |
|
| 40 | ||