8000 Call `sizeHint` in `Chunk.fromJavaIterable` when possible by guizmaii · Pull Request #7954 · zio/zio · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
/ zio Public

Call sizeHint in Chunk.fromJavaIterable when possible #7954

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

Merged
merged 2 commits into from
Mar 27, 2023

Conversation

guizmaii
Copy link
Member

No description provided.

* access to the size of the list, which allows us to optimize the chunk
* building process.
*/
def fromJavaList[A](list: java.util.List[A]): Chunk[A] = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Cool!

Copy link
Contributor

Choose a reason for hiding this comment

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

But I think you can test if the passing in is a List in fromJavaIterable too.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea! :)

Copy link
Member Author

Choose a reason for hiding this comment

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

@He-Pin I made the change. I used java.util.Collection instead of java.util.List as java.util.List is extending java.util.Collection and it also has this abstract size method.

Let me know what you think :)

@guizmaii guizmaii changed the title Add Chunk.fromJavaList Call sizeHint in Chunk.fromJavaIterable when possible Mar 27, 2023
@guizmaii guizmaii marked this pull request as ready for review March 27, 2023 11:52
@adamgfraser adamgfraser merged commit f8a3705 into zio:series/2.x Mar 27, 2023
@guizmaii guizmaii deleted the fromJavaList branch March 27, 2023 13:46
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.

3 participants
0