Map.Entry methods for streams

2016-01-15 Thread Stephen Colebourne
I've had a morning of discussion about streaming Map this morning. While there is clearly no appetite for a JDK MapStream right now, it does seem that two additional methods on Map.Entry could help. Two of the common cases when streaming over Map.Entry are to transform the keys and to transform

Re: Map.Entry methods for streams

2016-01-15 Thread Paul Sandoz
Hi, We have had multiple attempts at a BiStream for references. Mike had quite a good one. I thought my last attempt was rather good too :-) it avoided boxing on critical paths, while avoiding much bifurcation of the Spliterator API, and supported some nice use-cases. However, it would likely

Re: Clarification of BaseStream.onClose() behavior

2016-01-15 Thread Paul Sandoz
Hi Tagir, AutoCloseable.close states: * However, implementers of this interface are strongly encouraged * to make their {@code close} methods idempotent. It’s possible we just did not consider this aspect too much in BaseStream.close and we just lent on the "strongly encouraged”, which seems

JDK 9 RFR of JDK-8147480: Mark FJExceptionTableLeak.java as intermittently failing

2016-01-15 Thread joe darcy
Hello, We've seen some more low-frequency failures of java/util/concurrent/forkjoin/FJExceptionTableLeak.java Please review the patch below which records the known-intermittentness in the source of the test and demotes the test from tier 1 to tier 2. When the issue is resolved

RE: RFR: JDK-8144988: Unexpected timezone returned after parsing a date

2016-01-15 Thread Ramanand Patil
Hi Masayoshi, Thank you for pointing that out. I have removed line 29 from the test. Please review the updated Webrev: http://cr.openjdk.java.net/~rpatil/8141243/webrev.01/ Regards, Ramanand. -Original Message- From: Masayoshi Okutsu Sent: Friday, January 15, 2016 8:18 AM To:

Re: Map.Entry methods for streams

2016-01-15 Thread Peter Levart
Hi, Another possibility would be to introduce the following default methods to Map.Entry: public interface Map.Entry { ... default Map.Entry withKey(L key) { ... } default Map.Entry withValue(W value) { ... } } Usage would then look like:

Re: Map.Entry methods for streams

2016-01-15 Thread Tagir F. Valeev
Hello! SC> Finally, the Collectors class could do with a new method entriesToMap() SC> that collects a stream of Map.Entry back into a Map. I was thinking about adding such collector into my library and checked StackOverflow to understand the useful scenarios. Seems that having entriesToMap()

Re: JDK 9 RFR of JDK-8147480: Mark FJExceptionTableLeak.java as intermittently failing

2016-01-15 Thread Lance Andersen
+1 On Jan 15, 2016, at 1:01 PM, joe darcy wrote: > Hello, > > We've seen some more low-frequency failures of > > java/util/concurrent/forkjoin/FJExceptionTableLeak.java > > Please review the patch below which records the known-intermittentness in > the source of the

Re: JDK 9 RFR of JDK-8147480: Mark FJExceptionTableLeak.java as intermittently failing

2016-01-15 Thread Roger Riggs
Looks fine Joe. On 1/15/16 1:01 PM, joe darcy wrote: Hello, We've seen some more low-frequency failures of java/util/concurrent/forkjoin/FJExceptionTableLeak.java Please review the patch below which records the known-intermittentness in the source of the test and demotes the test from

RE: Map.Entry methods for streams

2016-01-15 Thread Timo Kinnunen
Hi, For completeness, having also the methods default Entry withKeyAsValue(NK newKey) { return new AbstractMap.SimpleEntry<>(newKey, getKey()); } public Entry withValueAsKey(NV newValue) { return new

Re: RFR 8146458 Improve exception reporting for Objects.checkIndex/checkFromToIndex/checkFromIndexSize

2016-01-15 Thread John Rose
On Jan 11, 2016, at 7:04 AM, Paul Sandoz wrote: > > When the new range check methods Object.check* were added the exception > reporting was a little vague and lossy, but i got a CCC pass to revisit later > on, and John nudged me to sort this out, so here is another more

Re: Map.Entry methods for streams

2016-01-15 Thread Tagir F. Valeev
Hello! Note that having single swap() method which just swaps key and value in addition to withKey/withValue covers this use case: Map gad = dag.entrySet() .stream() .flatMap(e -> e.getValue().stream().map(e.swap()::withKey)) .collect(groupingBy(Entry::getKey,

Re: Map.Entry methods for streams

2016-01-15 Thread Stephen Colebourne
So, this proposal is essentially trying to add something small to JDK 9 in advance of the long wait for value types and a full solution to the problem space. A stream of Map.Entry is painful today, and my idea or Remi's would definitely assist without pushing the API too far (I'm not such a fan of

Re: JDK 9 RFR of JDK-8147508: Correct fix for JDK-8147480

2016-01-15 Thread Martin Buchholz
looks good! On Fri, Jan 15, 2016 at 11:21 PM, joe darcy wrote: > Hello, > > Mea culpa, I omitted the line continuation characters in my recent fix for > JDK-8147480. > > Please review the patch below to add the continuation characters and restore > the full set of tests to