Re: RFR(s): 8072726: add adapter to convert Enumeration to Iterator

2015-05-16 Thread Stuart Marks
On 5/16/15 3:00 PM, Remi Forax wrote: Hi Stuart, this change is pretty cool, Hi Rémi, thanks for looking at this. In the javadoc of Iterator instead of: Iterable permsIterable = () -> pc.elements().asIterator(); one can write: Iterable permsIterable = pc.elements()::asIterator; Ah, I

Re: RFR(s): 8072726: add adapter to convert Enumeration to Iterator

2015-05-16 Thread Stuart Marks
Yeah, interesting. I think "convert" has too much of an implication of the resulting Iterator being independent of the underlying Enumeration, which it isn't. "View" is a good word, but it has to be understood with a specific meaning, e.g., List.subList creates a view of an underlying list. Perh

Re: RFR(s): 8072726: add adapter to convert Enumeration to Iterator

2015-05-16 Thread Stuart Marks
Hi guys, really going at it on a Saturday, eh? On 5/16/15 3:46 PM, Claes Redestad wrote: I also realized Iterable should typically allow multiple passes over the collection/enumeration, so this wouldn't feel right. Sorry! So... I'm happy with Stuart's proposal. Yep, that's the main reason not

Re: RFR(s): 8072726: add adapter to convert Enumeration to Iterator

2015-05-16 Thread Claes Redestad
On 2015-05-17 01:02, Remi Forax wrote: So... I'm happy with Stuart's proposal. I would also be happy (happier?) with a stream variant: pc.elements().stream().forEach(this::doSomethingWithPermission); We are not that far : pc.elements().asIterator().forEachRemaining(this::doSomethingWithPerm

Re: RFR(s): 8072726: add adapter to convert Enumeration to Iterator

2015-05-16 Thread Remi Forax
On 05/17/2015 12:46 AM, Claes Redestad wrote: On 2015-05-16 23:48, Remi Forax wrote: On 05/16/2015 06:21 PM, Claes Redestad wrote: Hi, any reason not to just have Enumeration extend Iterable and default-implement iterator()? http://cr.openjdk.java.net/~redestad/scratch/enumerable.00/ I

Re: RFR(s): 8072726: add adapter to convert Enumeration to Iterator

2015-05-16 Thread Claes Redestad
On 2015-05-16 23:48, Remi Forax wrote: On 05/16/2015 06:21 PM, Claes Redestad wrote: Hi, any reason not to just have Enumeration extend Iterable and default-implement iterator()? http://cr.openjdk.java.net/~redestad/scratch/enumerable.00/ I guess there are compatibility risks I haven't t

Re: RFR(s): 8072726: add adapter to convert Enumeration to Iterator

2015-05-16 Thread Remi Forax
Hi Stuart, this change is pretty cool, In the javadoc of Iterator instead of: Iterable permsIterable = () -> pc.elements().asIterator(); one can write: Iterable permsIterable = pc.elements()::asIterator; and I wonder if an example with NetworkInterface.getNetworkInterfaces() is not better,

Re: RFR(s): 8072726: add adapter to convert Enumeration to Iterator

2015-05-16 Thread Remi Forax
On 05/16/2015 06:21 PM, Claes Redestad wrote: Hi, any reason not to just have Enumeration extend Iterable and default-implement iterator()? http://cr.openjdk.java.net/~redestad/scratch/enumerable.00/ I guess there are compatibility risks I haven't thought through completely, but I think c

Re: RFR (XXS) 8080535: (ch) Expected size of Character.UnicodeBlock.map is not optimal

2015-05-16 Thread Chris Hegarty
> On 16 May 2015, at 01:59, Ivan Gerasimov wrote: > > On 16.05.2015 2:18, Martin Buchholz wrote: >> I don't think you're taking the load factor into account. > Hm. You're right, HashMap's constructor expects the capacity as the argument. > I was confused by IdentityHashMap, whose constructor ex

Re: RFR(s): 8072726: add adapter to convert Enumeration to Iterator

2015-05-16 Thread Chris Hegarty
This looks very useful. The javadoc reads well, and I think it is pitched at the right level ( view the Enumeration as an Iterator ). I expected to see ‘view’ or ‘convert’ in the javadoc, but what you have reads fine too. -Chris. > On 16 May 2015, at 01:37, Stuart Marks wrote: > > Hi all, >

Re: PriorityQueue

2015-05-16 Thread Paul Sandoz
On May 15, 2015, at 4:04 PM, Chris Hegarty wrote: > And/Or should PriorityQueue override addAll and provide a more performant > implementation for common Collection types ( just like the constructor )? > It should be possible to improve this case too: create a new array, appropriately sized,

Re: RFR(s): 8072726: add adapter to convert Enumeration to Iterator

2015-05-16 Thread Claes Redestad
Hi, any reason not to just have Enumeration extend Iterable and default-implement iterator()? http://cr.openjdk.java.net/~redestad/scratch/enumerable.00/ I guess there are compatibility risks I haven't thought through completely, but I think concrete classes that already implement both Enume

Re: RFR(M,v3): JDK-8059036 : Implement Diagnostic Commands for heap and finalizerinfo

2015-05-16 Thread Peter Levart
On 05/16/2015 02:38 PM, Peter Levart wrote: On 05/16/2015 09:35 AM, Dmitry Samersoff wrote: Derek, Personally, I'm for volatile over explicit fence too. So I'll change the code if Peter don't have objections. There are no objections. There's one unneeded volatile store to .next field th

Re: RFR(M,v3): JDK-8059036 : Implement Diagnostic Commands for heap and finalizerinfo

2015-05-16 Thread Peter Levart
On 05/16/2015 09:35 AM, Dmitry Samersoff wrote: Derek, Personally, I'm for volatile over explicit fence too. So I'll change the code if Peter don't have objections. There are no objections. There's one unneeded volatile store to .next field then in enqueue(), but it is followed by another

Re: RFR(M,v3): JDK-8059036 : Implement Diagnostic Commands for heap and finalizerinfo

2015-05-16 Thread Dmitry Samersoff
Derek, Personally, I'm for volatile over explicit fence too. So I'll change the code if Peter don't have objections. -Dmitry On 2015-05-16 01:59, Derek White wrote: > Hi Dmitry, Peter, > > I should read my email more frequently - I missed Dmitry's last webrev > email. > > My comments on a pre