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

Collect to map while dealing with collisions #2722

Closed
patrickguenther opened this issue Jul 14, 2022 · 2 comments
Closed

Collect to map while dealing with collisions #2722

patrickguenther opened this issue Jul 14, 2022 · 2 comments

Comments

@patrickguenther
Copy link

I would like to collect a stream of objects into a map, while dealing with duplicate keys analogous to the Java collector Collectors::toMap(Function, Function, BinaryOperator). Is there a canonical way of doing that?

@dbear496
Copy link
Contributor

dbear496 commented Jul 17, 2022

Will Traversable.toMap do what you want?

@patrickguenther
Copy link
Author

patrickguenther commented Sep 30, 2022

Of course, yes, I think that's what I was looking for.
Edit: I think this method is not available in the pre-alpha versions. Guess I need to upgrade.

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

2 participants