-
Bug
-
Resolution: Fixed
-
P4
-
None
-
None
-
b84
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8142090 | emb-9 | Paul Sandoz | P4 | Resolved | Fixed | team |
Collectors.counting is implemented as follows:
public static <T> Collector<T, ?, Long>
counting() {
return reducing(0L, e -> 1L, Long::sum);
}
As Tagir states here:
http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-September/035255.html
That implementation results in much boxing.The implementation could use summingLong instead:
public static <T> Collector<T, ?, Long>
counting() {
return summingLong(e -> 1L);
}
public static <T> Collector<T, ?, Long>
counting() {
return reducing(0L, e -> 1L, Long::sum);
}
As Tagir states here:
http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-September/035255.html
That implementation results in much boxing.The implementation could use summingLong instead:
public static <T> Collector<T, ?, Long>
counting() {
return summingLong(e -> 1L);
}
- backported by
-
JDK-8142090 Collectors.counting can use Collectors.summingLong to reduce boxing
-
- Resolved
-