RFR: JDK-8205461 Create Collector which merges results of two other collectors
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:
> A CSR is created:
> (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
>> Ok, sounds acceptable to me. Renamed pairing to teeingAndThen.
>> By the way looking into CollectorsTest.java I found some minor things to
>> 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 IDENTITY_FINISH only.
>> I think this should be a common case.
>> The updated webrev is posted here (along with Peter suggestion to
>> rename finisher to merger):
>> Also copyright year is updated
>> With best regards,
>> Tagir Valeev
More information about the core-libs-dev