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
Re-implement Stream.skip to have reasonable parallel behavior #4
Comments
As you can see, in this case
Try to test it. |
By the way I cannot reproduce your problem. I committed a testcase which works correctly both with |
Well, it's also possible that you are using an unordered collector as the terminal operation. For example, this test fails:
That's because
Or you can define your own collector which removes the |
I've created a separate branch and committed a new StreamEx.ofLines(new StringReader(input)).parallel().skip(1).recreate().toSet(); This method starts a new pipeline at given point while keeping the whole procedure lazy. The thing is that Please note that I'm not going to "fix" the existing skip method for a reason. The idea of my library is to extend the Stream API, which means that at every point where standard |
The |
After additional testing and rethinking I decided to replace the |
|
Brian Goetz approved that such |
Seems that the original Stream.skip is fixed for JDK 9 and backported to JDK 8u60. So my |
Currently, something like
StreamEx.ofLines(...).skip(1).parallel()....
doesn't do anything reasonable or useful. Instead of skipping the file's header, it skips a random line in the file. I think it should be possible to change its behavior to actually skip the first item if the source stream is ordered.The text was updated successfully, but these errors were encountered: