-
Sub-task
-
Resolution: Fixed
-
P3
-
None
-
b103
-
Verified
The Collector API, as initially specified, allows mutable reduction operations to be expressed in terms of three functions:
- create new result container
- incorporate one new data element into a result container
- merge two result containers
This is suitable for many summarization operations, such as simple reductions (e.g., sum, min, max), group-by, partition-by, etc. However, it is constraining that the intermediate type used for accumulation and the final result type must be the same; some problems, such as averaging, require a different internal type than final result type. (When averaging, a sensible intermediate representation is a holder for two mutable accumulators, sum and count, but the user almost always wants a double as the final result.) Additionally, it may be the case that there are invariants that the Collector would like to impose on its result (e.g., immutability, or tree balancing) that cannot be done efficiently by the accumulator.
- create new result container
- incorporate one new data element into a result container
- merge two result containers
This is suitable for many summarization operations, such as simple reductions (e.g., sum, min, max), group-by, partition-by, etc. However, it is constraining that the intermediate type used for accumulation and the final result type must be the same; some problems, such as averaging, require a different internal type than final result type. (When averaging, a sensible intermediate representation is a holder for two mutable accumulators, sum and count, but the user almost always wants a double as the final result.) Additionally, it may be the case that there are invariants that the Collector would like to impose on its result (e.g., immutability, or tree balancing) that cannot be done efficiently by the accumulator.
- duplicates
-
JDK-8015670 Need CCC approval for Collectors.toStringJoiner
-
- Closed
-
- is blocked by
-
JDK-8012238 Nested method capture and inference
-
- Closed
-
- relates to
-
JDK-8022622 javac, two tests are failing with compile time error after class Collector was modified
-
- Closed
-
-
JDK-8043772 Typos in Double/Int/LongSummaryStatistics.java
-
- Closed
-