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 KTypeIndexedContainer stream, sort and reverse methods. #250

Merged
merged 3 commits into from
May 25, 2024

Conversation

bruno-roustant
Copy link
Collaborator

The stream method is generated for generic, int, long and double, as there are no other primitive streams.
It is only available in KTypeIndexedContainer, and not Container, because the iteration of the stream would need to be randomized for hash set and hash map. I'm not sure it is possible, anyway out of scope of this PR.

The sort and reverse methods return the indexed container itself, to be able to chain calls. Let me know if it is not intuitive.

Copy link
Member

@dweiss dweiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. I don't think iteration order is crucial here. It could be added if you returned a stream backed by a custom spliterator... but it's much more complex - I don't think it's worth the effort.

Perhaps add a changes entry about these new utility functions?

@dweiss
Copy link
Member

dweiss commented May 25, 2024

Somewhat related to #26.

@dweiss dweiss added this to the 0.10.0 milestone May 25, 2024
@bruno-roustant bruno-roustant merged commit 38f14e8 into carrotsearch:master May 25, 2024
2 checks passed
@bruno-roustant bruno-roustant deleted the stream_sort branch May 25, 2024 16:33
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

Successfully merging this pull request may close these issues.

2 participants