Stream.cumulate issue
Georgiy Rakov
georgiy.rakov at oracle.com
Tue Dec 4 07:24:13 PST 2012
Hello,
cumulate().toArray() seems not to work properly with nulls. Consider
following code:
import java.util.Arrays;
import java.util.stream.Stream;
public class CumulateIssue {
public static void main(String [] argv) {
Stream<Object> stream = Arrays.parallel(new Object[]{null,
null, null, null}).cumulate((a, b)->3);
System.out.println(Arrays.toString(stream.toArray()));
}
}
It obviously should output:
[null, 3, 3, 3]
But instead it outputs:
[null, null, null, null]
I could suppose it's a bug. Please confirm if it is.
I use nightly build of November 5.
The code is attached for your convenience.
Thanks,
Georgiy.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CumulateIssue.java
Url: http://mail.openjdk.java.net/pipermail/lambda-dev/attachments/20121204/7823977b/CumulateIssue.java
More information about the lambda-dev
mailing list