RFR: 8005051: default methods for Iterator

Lance Andersen - Oracle Lance.Andersen at oracle.com
Fri Dec 14 04:50:48 PST 2012


On Dec 14, 2012, at 7:28 AM, Alan Bateman wrote:

> 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 <p> tags to make it a bit easier on the reader, minimally put the description of the default implementation isn't own paragraph.

This is why i am a proponent of adding a javadoc tag for default methods so that everyone is consistent in where/how we document the default method.  I worry if we do not developers will place this info in various places making it easy to overlook.
> 
> 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.
> 
> 

-------------- next part --------------

Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering 
1 Network Drive 
Burlington, MA 01803
Lance.Andersen at oracle.com



More information about the lambda-dev mailing list