-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
GroupBy currently uses sorting to efficiently group the data, however, this removes the original order of the data. Sometimes this is not preferred.
A new GroupBy strategy, i.e. ordered should be implemented.
For example:
$data = iterable([['key'=>'b'], ['key'=>'a'], ['key'=>'b']]);
$data->groupBy('key', 'SORT-STRATEGY')
// Result: ['a' => [['key'=>'a']], 'b' => [['key'=>'b'], ['key'=>'b']]]
// First the 'a' because it was sorted
$data->groupBy('key', 'ORDERED-STRATEGY')
// Result: ['b' => [['key'=>'b'], ['key'=>'b']], 'a' => [['key'=>'a']]]
// First the 'b' because the 'b' is first in $data