| @@ 248-259 (lines=12) @@ | ||
| 245 | * {@inheritDoc} |
|
| 246 | * @return $this |
|
| 247 | */ |
|
| 248 | public function zip(Iterable $iterable) |
|
| 249 | { |
|
| 250 | if (is_array($iterable)) { |
|
| 251 | $iterable = new ImmArrayList($iterable); |
|
| 252 | } |
|
| 253 | ||
| 254 | if ($iterable instanceof \Traversable) { |
|
| 255 | return new static(new LazyZipIterable($this, $iterable)); |
|
| 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($iterable) |
|
| 28 | { |
|
| 29 | if (is_array($iterable)) { |
|
| 30 | $iterable = new ImmArrayList($iterable); |
|
| 31 | } |
|
| 32 | ||
| 33 | if ($iterable instanceof \Traversable) { |
|
| 34 | return new ImmArrayList(new LazyConcatIterator($this, $iterable)); |
|
| 35 | } else { |
|
| 36 | throw new \InvalidArgumentException('Parameter must be an array or an instance of Traversable'); |
|
| 37 | } |
|
| 38 | } |
|
| 39 | } |
|
| 40 | ||