-
Bug
-
Resolution: Fixed
-
P1
-
8, 9
-
b01
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8032140 | 8u20 | Paul Sandoz | P1 | Closed | Fixed | b01 |
JDK-8032422 | 8u5 | Paul Sandoz | P1 | Resolved | Fixed | b05 |
JDK-8031424 | 8 | Paul Sandoz | P1 | Closed | Fixed | b124 |
The code for the DoubleStream.count method is incorrect:
public final long count() {
return mapToObj(e -> null).mapToInt(e -> 1).sum();
}
If a a double stream contains more than Integer.MAX_VALUE then the sum will overflow resulting in an incorrect value. The code should be:
public final long count() {
return mapToLong(e -> 1).sum();
}
public final long count() {
return mapToObj(e -> null).mapToInt(e -> 1).sum();
}
If a a double stream contains more than Integer.MAX_VALUE then the sum will overflow resulting in an incorrect value. The code should be:
public final long count() {
return mapToLong(e -> 1).sum();
}
- backported by
-
JDK-8032422 DoubleStream.count is incorrect for a stream containing > Integer.MAX_VALUE elements
- Resolved
-
JDK-8031424 DoubleStream.count is incorrect for a stream containing > Integer.MAX_VALUE elements
- Closed
-
JDK-8032140 DoubleStream.count is incorrect for a stream containing > Integer.MAX_VALUE elements
- Closed