Re: Java 9 and IntSummaryStatistics et al.

2017-04-05 Thread Chris Dennis
I can do that. I’ve done this before a couple of times, so it should be reasonably familiar. Will attempt to whip something up in the next couple of days. Thanks, Chris > On Apr 5, 2017, at 12:30 PM, Paul Sandoz wrote: > > Hi Chris, > > I logged this issue: > > https://bugs.openjdk.java.n

Re: Java 9 and IntSummaryStatistics et al.

2017-04-05 Thread Brian Goetz
Adding a new public ctor to initialize the state to a known value seems reasonable to me. On 4/5/2017 8:57 AM, Chris Dennis wrote: Taking from this conversation that there is consensus (at least amongst those on this thread) that this is an issue that should be fixed, what should my next step

Re: Java 9 and IntSummaryStatistics et al.

2017-04-05 Thread Paul Sandoz
Hi Chris, I logged this issue: https://bugs.openjdk.java.net/browse/JDK-8178117 Do you want to provide a patch? I can help guide you through the process. See here if not already familiar: http://openjdk.java.net/contribute/

Re: Java 9 and IntSummaryStatistics et al.

2017-04-05 Thread Chris Dennis
Taking from this conversation that there is consensus (at least amongst those on this thread) that this is an issue that should be fixed, what should my next steps be in order to help move this forward? > On Mar 30, 2017, at 10:01 AM, Peter Levart wrote: > > > > On 03/30/2017 03:14 PM, Chris

Re: Java 9 and IntSummaryStatistics et al.

2017-03-30 Thread Peter Levart
On 03/30/2017 03:14 PM, Chris Dennis wrote: This is indeed nice… but I presume that we all agree that the best solution here would be to allow instantiation of an IntSummaryStatistics object in a specific state. Of course. I just couldn't resist the challenge of Rémi's nice math exercise..

Re: Java 9 and IntSummaryStatistics et al.

2017-03-30 Thread Chris Dennis
This is indeed nice… but I presume that we all agree that the best solution here would be to allow instantiation of an IntSummaryStatistics object in a specific state. > On Mar 29, 2017, at 2:43 PM, Peter Levart wrote: > > > > On 03/29/2017 06:06 PM, Chris Dennis wrote: >> Remi: I really hav

Re: Java 9 and IntSummaryStatistics et al.

2017-03-29 Thread Peter Levart
On 03/29/2017 06:06 PM, Chris Dennis wrote: Remi: I really have to squint pretty hard to see that as anything other than “brute-force” - it’s still an O(N) calculation. Here's O(log2(N)): static IntSummaryStatistics create(long count, long sum, int min, int max) { if (count <

Re: Java 9 and IntSummaryStatistics et al.

2017-03-29 Thread Paul Sandoz
> On 29 Mar 2017, at 10:22, Peter Levart wrote: > > Hi Chris, > > On 03/29/2017 06:06 PM, Chris Dennis wrote: >> Remi: I really have to squint pretty hard to see that as anything other than >> “brute-force” - it’s still an O(N) calculation. >> >> Paul: Right - but if I’m trying to implement t

Re: Java 9 and IntSummaryStatistics et al.

2017-03-29 Thread Peter Levart
Hi Chris, On 03/29/2017 06:06 PM, Chris Dennis wrote: Remi: I really have to squint pretty hard to see that as anything other than “brute-force” - it’s still an O(N) calculation. Paul: Right - but if I’m trying to implement the Streams API directly thats pretty much a non-starter, right. I t

Re: Java 9 and IntSummaryStatistics et al.

2017-03-29 Thread Chris Dennis
Remi: I really have to squint pretty hard to see that as anything other than “brute-force” - it’s still an O(N) calculation. Paul: Right - but if I’m trying to implement the Streams API directly thats pretty much a non-starter, right. I think at this point the simplest change here would be to

Re: Java 9 and IntSummaryStatistics et al.

2017-03-29 Thread Paul Sandoz
> On 29 Mar 2017, at 03:32, Remi Forax wrote: > > Seems a nice Math exercise. > if you have the min, the max, the count and the sum, how to re-create an > IntSummaryStatistics knowing you can only uses accept ? > > What about calling accept() with the min, the max and (count - 2) times the >

Re: Java 9 and IntSummaryStatistics et al.

2017-03-29 Thread Remi Forax
Seems a nice Math exercise. if you have the min, the max, the count and the sum, how to re-create an IntSummaryStatistics knowing you can only uses accept ? What about calling accept() with the min, the max and (count - 2) times the (sum - min - max) / (count - 2) ? Obviously, if the remainder i