-
Notifications
You must be signed in to change notification settings - Fork 168
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
Don't buffer stream inside of toString() #259
Comments
Streams are aimed to large(r) data sets (i.e. toString() is pointless anyways) and on purpose composable and lazily evaluated. Consider debugging through this:
And the current |
@tcn: Personally, I don't buy the "large(r)" data set argument. Most people will use streams as glorified collections, i.e. stuff with 1000 elements in it, where the stream source is in memory already. Anyway, I see your point :) |
That's why |
No, why? |
https://blog.jetbrains.com/idea/2016/09/intellij-idea-2016-3-eap-helps-migrate-to-java-8s-stream-apis/ ok, you were probably right :) |
Wow, that's impressive. But what do you mean by "I was right"? With what? |
Uhm, well, that "most" people will use Stream/Seq as "glorified collections"; now that IntelliJ has this particular feature. |
Aha, I thought it was referring to the |
Hardly anyone uses DB cursors. |
Seq
currently buffers any stream when callingtoString()
because this allows for a nice display in debuggers without wasting the stream / modifying program behaviour.However, buffering the stream has side effects, mainly also when debugging, breakpoints inside of a stream's lambda transformations might no longer be triggered because the stream is evaluated / consumed on
toString()
, no longer in the real code. See:https://youtrack.jetbrains.com/issue/IDEA-160867
The text was updated successfully, but these errors were encountered: