Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-09-24 Thread Tagir Valeev
> In the CSR, I updated the webrev link to point to the latest, I set the > fix-version to 12, and I set the scope to SE. I've marked the CSR reviewed. > > The next thing is for you to mark the CSR as Finalized. Done, thanks! With best regards, Tagir Valeev > > Thanks, > > s'marks > > > On

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-09-24 Thread Stuart Marks
Webrev looks good. In the CSR, I updated the webrev link to point to the latest, I set the fix-version to 12, and I set the scope to SE. I've marked the CSR reviewed. The next thing is for you to mark the CSR as Finalized. Thanks, s'marks On 9/24/18 3:39 AM, Tagir Valeev wrote: Ok,

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-09-24 Thread Tagir Valeev
Ok, teeing. Webrev updated: http://cr.openjdk.java.net/~tvaleev/webrev/8205461/r6/ CSR updated accordingly: https://bugs.openjdk.java.net/browse/JDK-8209685 With best regards, Tagir Valeev. On Fri, Sep 21, 2018 at 8:26 PM Brian Goetz wrote: > > The example of ISS is a good one. It is analogous

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-09-21 Thread Brian Goetz
The example of ISS is a good one.  It is analogous to the question of "when is it right to write a class, and when it is right to write a function?"  And the answer is, of course, "it depends."  ISS was an obvious grouping, but even there there was significant disagreement during its design

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-09-16 Thread Tomasz Linkowski
I agree with Tagir that supporting more than two Collectors sounds risky. I especially agree that well-typed and well-named accessors are important. I use the quoted library (jOOL), but I: - either avoid all those tuple-based functions, - or I use only Tuple2/Tuple3 and I map the tuple to a

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-09-16 Thread Tagir Valeev
Hello, Brian! Regarding more than two collectors. Some libraries definitely have analogs (e.g. [1]) which combine more than two collectors. To my opinion combining two collectors this way is an upper limit for readable code. Especially if you are going to collect to the list, you will have a list

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-09-15 Thread Brian Goetz
tl;dr: "Duplexing" is an OK name, though I think `teeing` is less likely to be a name we regret, for reasons outlined below. The behavior of this Collector is:  - duplicate the stream into two identical streams  - collect the two streams with two collectors, yielding two results  - merge the

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-09-14 Thread Tagir Valeev
Hello! Tomasz, Peter, Stuart, Remi, thank you for review and comments. I updated the webrev: http://cr.openjdk.java.net/~tvaleev/webrev/8205461/r5/ 1. ? extends R -> R 2. parameter names c1, c2 -> downstream1, downstream2; Objects.requireNonNull messages updated correspondingly merger is left as

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-09-14 Thread Tomasz Linkowski
Hi all, Stuart, thanks for your response and explanations, I really appreciate it! Good point about function composition - didn't cross my mind, but it could be confusing indeed. As for "merger" - good point about "biFinisher", but I'm still unconvinced about "merger", because usually, you

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-09-14 Thread Federico Peralta Schaffner
Hi, I've already sent an email to this list regarding this issue, but I'm not sure if it finally made its way. So here I'm sending something again w.r.t the name... duplexing might be OK, but collectingBothAndThen is hard to beat. Arguments: - Existing collectingAndThen method is the simpler

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-09-14 Thread Stuart Marks
Hi Tagir, thanks for the update. Also thanks Tomasz for keeping everybody honest on the open issues. First, naming. I think "duplex" as the root word wins! Using "duplexing" to conform to many of other collectors is fine; so, "duplexing" is good. Unfortunately "duplex" is not really a verb.

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-09-14 Thread Tomasz Linkowski
Hi, I'd like to remind three little things to which there was no response (AFAIK): 1) Brian Goetz' suggestion of changing "? extends R" into "R": - http://mail.openjdk.java.net/pipermail/core-libs-dev/2018-August/054947.html 2) Stuart Marks' suggestion about renaming "c1" and "c2" to

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-09-14 Thread Remi Forax
I'm neither Stuart nor Peter but this looks good to me. Rémi - Mail original - > De: "Tagir Valeev" > À: "Stuart Marks" > Cc: "core-libs-dev" > Envoyé: Vendredi 14 Septembre 2018 10:41:53 > Objet: Re: RFR: JDK-8205461 Create Collector wh

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-09-14 Thread Peter Levart
Hi Tagir, I like duplexing more than teeingAndThen. If consensus can be established about the name, I think you will then want to update the CSR draft to reflect new name. Then we'll kindly ask Stuart if he has any more advice before submitting the CSR... Regards, Peter On 09/14/2018 10:41

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-09-14 Thread Tagir Valeev
Hello, Stuart and Peter! Thank you for valuable comments. I updated the webrev: http://cr.openjdk.java.net/~tvaleev/webrev/8205461/r4/ 1. I renamed "teeingAndThen" to "duplexing". Brian insisted that "-ing" suffix shall present and I agree. Hopefully it's final name. 2. I updated the spec as

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-09-10 Thread Zheka Kozlov
public static Collector collectingAndThen( Collector downstream, Function finisher); public static Collector collectingAndThen( Collector downstream1, Collector

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-08-21 Thread Stuart Marks
On 8/21/18 12:04 AM, Peter Levart wrote:  - UNORDERED: should the returned collector be UNORDERED if *either* of the provided collectors is UNORDERED? (Current draft says *both*.) I think *both* is the right behavior. If you are collecting:     teeingAndThen(         Collectors.toList(),      

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-08-21 Thread Peter Levart
I just note that sometimes naming is hard. Not because there would be no suitable name to choose from but because there are too many. In such situations it becomes apparent that every individual's brain works slightly differently. That said, I must admit that teeingAndThen is not my favorite

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-08-21 Thread Peter Levart
Hi Stuart, On 08/21/2018 07:43 AM, Stuart Marks wrote: 2. Characteristics  - UNORDERED: should the returned collector be UNORDERED if *either* of the provided collectors is UNORDERED? (Current draft says *both*.) I think *both* is the right behavior. If you are collecting:    

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-08-20 Thread Stuart Marks
Hi Tagir, Thanks for working on this. This looks really cool! And thanks Peter for agreeing to sponsor it. I can help out with the CSR. My first bit of advice about the CSR process is to hold off until the specification is complete. :-) I think the intent of the API is fine, but I think

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-08-20 Thread Brian Goetz
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. 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

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-08-20 Thread Federico Peralta Schaffner
Hi, I think this is a very good addition to the Collectors API. Whereas somehow specific, it will come in very handy when needed. But the name... well, honestly, teeingAndThen doesn't tell me anything from the perspective of an user of the API. What is 'teeing'? What does 'tee' actually mean? Or

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-08-20 Thread Tagir Valeev
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 wrote: > > Hi Tagir, > > I think this looks very good. It just needs a CSR. Will you file

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-08-20 Thread Peter Levart
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

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-08-19 Thread Tagir Valeev
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

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-08-19 Thread Tagir Valeev
Hello, Peter! Yes, I would be happy, though see also Roger note. > Regarding the code, I only have one comment about the naming of the last parameter: "finisher" Sounds reasonable, renamed to "merger". > ...and one comment about handling of IDENTITY_FINISH I think this would complicate the

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-08-07 Thread Brian Goetz
On 6/21/2018 12:33 AM, Tagir Valeev wrote: Please review and sponsor: https://bugs.openjdk.java.net/browse/JDK-8205461 http://cr.openjdk.java.net/~tvaleev/webrev/8205461/r1/ See also previous discussion thread at [1]. It seems that we did not reach the final conclusion about the collector

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-08-07 Thread Roger Riggs
Hi, As an API addition, it will need a CSR as well and it should have a couple of reviewers that are fully aware of Streams design. Regards, Roger On 8/7/18 4:08 AM, Peter Levart wrote: Hi Tagir, Unless you have already got a sponsor (can't remember if somebody already offered you a

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-08-07 Thread Peter Levart
Hi Tagir, Unless you have already got a sponsor (can't remember if somebody already offered you a sponsorship), I can volunteer. Regarding the code, I only have one comment about the naming of the last parameter: "finisher". To avoid confusion, it would be good to name it differently from

Re: RFR: JDK-8205461 Create Collector which merges results of two other collectors

2018-08-06 Thread Tagir Valeev
Ping! Could you please review and sponsor this changeset? I updated version tag from since 11 to since 12: http://cr.openjdk.java.net/~tvaleev/webrev/8205461/r2/ Thanks in advance! With best regards, Tagir Valeev. On Thu, Jun 21, 2018 at 11:33 AM Tagir Valeev wrote: > Please review and