Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add groupByEachUniqueKey to RichIterable #1565

Open
donraab opened this issue Mar 22, 2024 · 0 comments
Open

Add groupByEachUniqueKey to RichIterable #1565

donraab opened this issue Mar 22, 2024 · 0 comments

Comments

@donraab
Copy link
Contributor

donraab commented Mar 22, 2024

RichIterable currently has groupBy / groupByEach but only has groupByUniqueKey without the corresponding groupByEachUniqueKey. The method groupByEachUniqueKey would index an item in a Map using multiple keys. Each key will only point to one value. An example of this might be mapping a Person to his/her aliases.

I ran into this problem recently trying to group an Object that contains a distinct range of numbers by each of the distinct numbers. I was able to accomplish this by using a nested injectInto, but it is somewhat awkward and may be difficult to comprehend. In my particular case, it is more optimal using injectInto as I am grouping into an IntObjectMap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant