RFR: 8005051: default methods for Iterator (original) (raw)

Alan Bateman Alan.Bateman at oracle.com
Fri Dec 14 12:28:30 UTC 2012


On 14/12/2012 01:24, Akhil Arora wrote:

As part of the library lambdafication, this patch adds a forEach default method to Iterator, and converts remove() into a default method so that implementations of Iterator no longer have to override remove if they desire the default behavior, which is to throw an UnsupportedOperationException.

http://cr.openjdk.java.net/~akhil/8005051.0/webrev/ I looked at the changes to Iterator, a few minor comments:

I think it would help to change "This default implementation" to "The default implementation", it makes it more obviously normative (and so testable) and might help for sub-types that override the method but don't inherit the javadoc.

I assume the generated javadoc ends as a long paragraph, did you consider putting in

tags to make it a bit easier on the reader, minimally put the description of the default implementation isn't own paragraph.

Should Collection have a lowercase "c" as it may be an iterator over a collection that is not a java.util.Collection?

In forEach then it may be smoother to change "... execution subsequent ..." to "... execution then subsequent ...".

As per the other thread, if new methods are coming with the public modifier then I think it should be added to the existing methods.

-Alan.



More information about the core-libs-dev mailing list