Skip to content
This repository has been archived by the owner on Jun 20, 2018. It is now read-only.

Commit

Permalink
Fixed bug
Browse files Browse the repository at this point in the history
  • Loading branch information
italolelis committed Dec 1, 2015
1 parent 4a467be commit 033959a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Rx/RxTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Collections\Iterator\InsertIterator;
use Collections\Iterator\ReplaceIterator;
use Collections\Iterator\UnfoldIterator;
use Collections\VectorInterface;
use LimitIterator;
use RecursiveIteratorIterator;

Expand Down Expand Up @@ -250,7 +251,8 @@ public function groupBy($callback)
foreach ($this as $value) {
$key = $callback($value);
if (!$group->containsKey($key)) {
$group->add($key, new static([$value]));
$element = $this instanceof VectorInterface ? new static([$value]) : new ArrayList([$value]);
$group->add($key, $element);
} else {
$value = $group->get($key)->add($value);
$group->set($key, $value);
Expand Down

0 comments on commit 033959a

Please sign in to comment.