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 toMapKey() method #238

Closed
stickfigure opened this issue Dec 18, 2020 · 2 comments
Closed

Add toMapKey() method #238

stickfigure opened this issue Dec 18, 2020 · 2 comments
Milestone

Comments

@stickfigure
Copy link
Contributor

A minor feature request:

IMO, the streams designers made one ergonomic mistake - the one-argument toMap() method takes a valuemapper instead of a keymapper. I guess they flipped a coin? In my entire life I have never used the one-argument valuemapper, but I write this all the time:

toMap(Thing::getKey, Function.identity())

It would be more ergonomic to simply write:

toMapKey(Thing::getKey)

(or any other method name; it doesn't have to be toMapKey)

It would be lovely if StreamEx added this little convenience method. Thanks!

@amaembo
Copy link
Owner

amaembo commented Nov 7, 2021

Thanks. I renamed methods to valuesToMap(), valuesToSortedMap() and valuesToNavigableMap().

@amaembo amaembo closed this as completed Nov 7, 2021
@stickfigure
Copy link
Contributor Author

That's great, thanks!

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