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
Set size and characteristics for Spliterator used with Tags and KeyValues #3409
Conversation
Tags and KeyValues were inheriting their spliterator method from Iterable, which returns a Spliterator with unknown size and no characteristics set.
2b505dd
to
78c9e8b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the pull request. This does seem better in principle and we should do it. I'm curious, though, if you found this due to some negative effect in your code using this.
I did not observe any actual problems due to this, but it's easy to demonstrate how it can lead to inefficiencies. It is something I stumbled across and seems to be fairly common for code that extends Here are a couple of examples of why it can be good to propagate the exact size:
I didn't comb through all of the internals of |
I forgot to mention that an additional benefit to overriding the |
Thank you for the added details. That makes sense. I was wondering if there were examples of places in code outside of this repository that Tags spliterator is being used, so I can learn about some usage in users' code that I might not have thought about. It's a bit hard to do a GitHub search for these things given the generic method names, and of course there is a lot of code that isn't in GitHub that may be using this. |
Tags and KeyValues were inheriting their spliterator method from Iterable, which returns a Spliterator with unknown size and no characteristics set.