RFR 8071600: Add a flat-mapping collector

Stuart Marks stuart.marks at oracle.com
Tue Feb 10 23:02:18 UTC 2015


Hi Paul,

On 2/3/15 5:48 AM, Paul Sandoz wrote:
> http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8071600-Collector-flatMapping/webrev/
>
> This patch adds a new flat mapping collector to Collectors. This can be useful if one needs to map 0 or more items into a downstream collector.

Mostly pretty good, just a couple minor nits.

Re the comment at TabulatorsTest.java line 513, this isn't a two-level groupBy 
anymore, it's a groupByWithMapping (as the test name indicates).

Given the new tests of closing in FlatMapOpTest.java, is it necessary to have 
testFlatMappingClose() in TabulatorsTest.java?

> A following patch, which i plan to fold into the above patch, performs some renames on the collectors test to be consistent with the current naming:
>
> http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8071600-Collector-flatMapping-test-rename/webrev/

Renaming looks good and makes it easy to correlate the tests, the assertion 
classes, and the collector implementations under test. Unfortunately, the word 
for the act of collecting is "collection" which is confusing since "collection" 
already has another meaning, but oh well.

s'marks




More information about the core-libs-dev mailing list