RFR: JDK-8205461 Create Collector which merges results of two other collectors (original) (raw)

Brian Goetz brian.goetz at oracle.com
Tue Aug 21 01:37:19 UTC 2018


I note that the only place that R appears is in the output of the merger.  So the "? extends" is not needed there; it can be just BiFunction<? super R1, ? super R2, R>.

On 8/20/2018 4:48 AM, Tagir Valeev wrote:

Hello!

A CSR is created: https://bugs.openjdk.java.net/browse/JDK-8209685 (this is my first CSR, hopefully I did it correctly) With best regards, Tagir Valeev. On Mon, Aug 20, 2018 at 2:06 PM Peter Levart <peter.levart at gmail.com> wrote: Hi Tagir,

I think this looks very good. It just needs a CSR. Will you file it? Regards, Peter On 08/19/2018 11:24 AM, Tagir Valeev wrote: Hello, Brian! Of the three phases, teeing is the most important and least obvious, so I think something that includes that in the name is going to be helpful. Perhaps "teeingAndThen" is more evocative and not totally unwieldy. Ok, sounds acceptable to me. Renamed pairing to teeingAndThen. By the way looking into CollectorsTest.java I found some minor things to cleanup: 1. .map(mapper::apply) and .flatMap(mapper::apply) can be replaced with simple .map(mapper) and .flatMap(mapper) respectively Does IntelliJ have an inspection for eliminating such locutions? Sure, that's how I found them. Well, I took the liberty to fix these two things. 2. In many methods redundant throws ReflectiveOperationException is declared while exception is never thrown For test code where a significant fraction of test cases are going to throw something, we often do this, since its easier to just uniformly tag such methods rather than thinking about which test methods actually throw the exception and which don't. So I think this is harmless (though cleaning it up is harmless too.) I'm not thinking about this, because my IDE thinks for me :-) Ok, I'll leave them as is for now. You may want to optimize the EnumSet mechanics for the case where neither collector has interesting characteristics. Added a special case when reported characteristics for either of collectors are empty or IDENTITYFINISH only. I think this should be a common case. The updated webrev is posted here (along with Peter suggestion to rename finisher to merger): http://cr.openjdk.java.net/~tvaleev/webrev/8205461/r3/ Also copyright year is updated With best regards, Tagir Valeev



More information about the core-libs-dev mailing list